pendingMessages Puzzle (was pendingmessages) -- Bingo!! (spoiler)

Dar Scott dsc at swcp.com
Thu Jun 19 16:33:00 EDT 2003


On Thursday, June 19, 2003, at 03:06 PM, Scott Slaugh wrote:

>>>>> Puzzle for Revolutionaries:  Watch messages in realtime.  There is 
>>>>> one
>>>>> message you can't ever see, even though it is almost always in the
>>>>> pendingMessages.  What message is that?
>>>>
>>>> idle?
>>>
>>> I don't know how that is implemented, but I don't think it is ever 
>>> in pendingMessages().
>>>
>>> Nope.  That is not the answer I'm thinking of.
>>
>> Any more attempts, folks?
>
> How about revAutoRefresh?

Yes!

This is the handler that does the auto update for the messages.  See 
that sneaky phrase above, "Watch messages in realtime."

The handler examines the pendingMessages before doing the send for the 
next one.  So for the first part of the execution of the handler it is 
not in pendingMessages, but it is in for the rest of the time.

I think this is good practice.  If the timing period is not critical, 
then send at the end.  This way you automatically slow down and don't 
contribute to problems when messages get bogged down.  In this case, 
with only a single field update and a quarter second period, it is not 
critical.

I did notice that revAutoRefresh checks whether the stack starts with 
"rev" rather than check the handler starts with "rev" as my handler 
does.  This has the advantage of including messages with fixed engine 
names the programmer can't change such as socketClosed.

Dar Scott




More information about the use-livecode mailing list