wait 0 with messages

Paul Dupuis paul at researchware.com
Sat Jul 30 22:02:54 EDT 2022

On 7/30/2022 7:49 PM, Mark Wieder via use-livecode wrote:
> On 7/30/22 12:53, Paul Dupuis via use-livecode wrote:
>> My understanding of 'wait 0 with messages' is that it will cause any 
>> pending messages, that are not scheduled for a time later than the 
>> current time, in the pendingMessages queue to be processed before 
>> continuing. Messages later than the current time (when the statement 
>> is executed) will not be processed (yet).
>> Is this correct?
> My understanding of this is close but not quite the same.
> The "wait 0 with messages" statement is the fastest implementation 
> ("wait 0") of an opportunity for the system event loop to process any 
> pending instructions. The "with messages" statement in effect yields 
> control to the event loop to check if any "send in time" messages have 
> timed out and are pending or to handle other tasks that may have 
> accumulated (mouse or keyboard events, etc).

So Mark,

Your understanding is that 'wait 0' (WITHOUT with messages) would allow 
OS events like a screen redraw, USB drive insertion/removal, etc. but 
NOT livecode engine events in the queue like mouseDown, mouseUp, 
resumeStack, etc,


That wait 0 (again without with messages) would include in addition to 
OS events, LC built-in events like mouseDown, resumeStack, etc., but not 
custom messages (or LC standard messages) sent to the queue via sent in 

Thanks for responding!

More information about the use-livecode mailing list