sluggishness of 8.1.1 on send in 0/wait 0 pairs?

Peter TB Brett peter.brett at livecode.com
Wed Oct 26 04:36:34 EDT 2016


On 25/10/2016 21:30, Monte Goulding wrote:
>
>> On 26 Oct. 2016, at 6:55 am, Dr. Hawkins <dochawk at gmail.com> wrote:
>>
>> *unless* there is an opportunity to execute it, such as (exclusively?)
>> "Wait with messages", at which point the message due is supposed to be
>> checked.
>>
>> send in time is supposed to return a message queue id of the message,
>> meaning it's already supposed to, well,  be in the queue
>
> Send in time has does not guarantee when a message will be sent. It’s ASAP after the event time. If there is a pending message that should be handled before the message you sent then it will be handled and then you will run out of time because you are only waiting 0. If you need to guarantee that you are waiting until the message is sent then do something like:
>
> local sHandled
>
> on Foo
>     put false into sHandled
>     send “Bar” to me in 0
>     wait until sHandled with messages
>     — do something else
> end Foo
>
> on Bar
>    put true into sHandled
> end Bar

Hi Monte and Richard,

I think there might be an actual bug that Richard has found here. 
Recently Fraser had to dig into the message queue implementation, and 
while reviewing some of his changes, I spotted a problem.

If you had multiple messages ready to be dispatched, LiveCode would skip 
processing a message after each dispatch (and then keep reprocessing the 
queue until all of them were dealt with).  So, if you had a message 
queue with 7 messages ready to go, LiveCode would dispatch them in this 
order:

1, 3, 5, 7, 2, 6, 4

This _could_ account for the behaviour that Richard is reporting. I know 
that it is fixed in the development branch [1].  Richard, do you have 
the same issue when you run your stack in LiveCode 9 DP 1?

                                      Peter

[1] 
https://github.com/livecode/livecode/commit/10264f981d29c0ef97e25f89362ab8e2b36b5499

-- 
Dr Peter Brett <peter.brett at livecode.com>
LiveCode Technical Project Manager

lcb-mode for Emacs: https://github.com/peter-b/lcb-mode




More information about the use-livecode mailing list