what actually happens when sending a message out of a repeat loop?

Richard Gaskin ambassador at fourthworld.com
Thu Jun 19 10:41:47 EDT 2008


Tiemo Hollmann wrote:
> I have a repeat loop and send a message to another handler from within the
> repeat loop with parameters, which change every loop.
> 
> If using a function call instead of the message, the main handler would wait
> until the function returns back, but when sending a message, the loop is
> running on. So what happens now, if the sub handler takes "much longer" as
> the main handler and the loop turns hundred of times. Will all the send
> messages to the sub handler with the changed parameters kept in the
> messagequeue safely and being processed, even after the main handler has
> finished already? Are there any limitations in message numbers or size of
> this messagequeue?

When you send a message like this:

   repeat 100
    send "DoSomething" to btn "SomeScripts"
   end repeat

...it executes DoSomething and only returns to the calling handler when 
DoSomething finishes.

But if you use this form:

   repeat 100
    send "DoSomething" to btn "SomeScripts" in 10 millisecs
   end repeat

...then the repeat loop will continue, and DoSomething (like all timer 
messages) will only be fired once the engine hits idle.

Are you using the "send...in <time>" form?

If not, we may need to see your scripts to figure out what's going on there.

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list