wait with messages...

Dave Cragg dcragg at lacscentre.co.uk
Sun Feb 1 04:47:56 EST 2004


At 12:14 am -0600 1/2/04, Chipp Walters wrote:

>Would it be something like:
>
>wait for 4 seconds with messages

I'm not sure if that will work. The old Metacard docs only show the 
"with messages" option being valid with the "wait until" or "wait 
while" variations of wait. I.e. it needs a condition. But the Rev 
docs shows it being OK with "wait for" as well.

>wait for messages
>(pauses handler until *any* message is received? and why would I ever use
>this?)
>
>I have a feeling there's some great power here, I just want to understand
>how to use it!

This one puzzled me when I took over libUrl. It was full of snippets 
like this (and still is):

repeat until <condition>
   wait for messages
end repeat

It seemed the same as this:

wait until <condition> with messages.

But Scott (Raney) told me that the "wait for messages" in the repeat 
loop is much more efficient as the condition is tested only when a 
message is sent. In the single liner, the condition is tested 
continually ( a bit like "idle").

My own limited testing at the time didn't seem to show a great 
difference in how often the condition was tested. But the explanation 
seemed sensible, so I stuck with the "wait for messages" in the 
repeat loop.

Cheers
Dave


More information about the use-livecode mailing list