> On 23 Jan 2015, at 03:26, J. Landman Gay <jac...@hyperactivesw.com> wrote:
> 
> Suppose I have a long handler that includes a few "wait with messages" so 
> that users can continue interacting with the stack while it runs. The user 
> does something that calls the long handler while it is still running from a 
> previous instance. Assume there is no flag in the script to prevent that.
> 
> Does the engine queue the second call until the long handler finishes, and 
> then send the message from the second call (serial responses)?
> 
> Or does the engine run two instances of the long handler simultaneously? If 
> so, what happens to the values of the variables?
> 
> Or something else?

One issue might be the nesting of the "waits". It’s a while since I’ve done 
this, but I think the waits need to be released in reverse order of how they 
were applied. So if you run the handler three times, the first and second calls 
won’t return until the "wait" in the third call has cleared. See if the 
following script in a button does what you would expect when you click it three 
times in succession (less than 5 seconds between clicks).


local lvCount = 0

on mouseUp
   add 1 to lvCount
   put 5 into tTime
    put "start " & lvCount & cr after field 1
   testHandler tTime, lvCount
end mouseUp

on testHandler pSecs, pCount
   wait pSecs seconds with messages
   put "end " & pCount & cr after field 1   
end testHandler

Cheers
Dave Cragg
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to