wait with messages

Dar Scott dsc at swcp.com
Wed Aug 11 12:29:34 EDT 2004


On Aug 11, 2004, at 9:55 AM, Dar Scott wrote:

>> Without polling what is the best way to wait (while messages continue 
>> processing) for a viriable state to change?  Since wait with messages 
>> is presenting several anomalies I cannot explain.
>
> One way would be to use a custom command (hander) to set the variable. 
>  It can 'send ... in 0'.  A possible problem is that it might queue up 
> several messages before execution completes and only one is needed.
>
> Another way is to call a routine to check what needs to be done at the 
> end of routines and it can do the sends.

By the way, polling may not be so bad if you don't need a fast 
response.  Use a cycle like one of the flashers in the primer.  Maybe 
you can poll every 100 or 200 ms or even faster.  Look at the cpu meter 
if you are concerned.

In the case of something like a FIFO, you might give the fifo a message 
to send whenever it becomes empty and a message to send every time it 
become nonempty.  If you put a cycle in that to check the state and 
send the message, that is mostly a fallback and would not affect the 
normal performance.

Dar Scott



More information about the Use-livecode mailing list