On Jan 6, 2010, at 8:21 AM, Bert Freudenberg wrote:

On 18.12.2009, at 19:58, Josh Gargus wrote:

messages and that any #future: messages sent with the same delay should be queued in the order they are sent.

Without question.  This is a limitation of the current implementation.

Thinking about this, I'd suspect using #addAlarm:withArguments:for:at: instead of #addDeferredUIMessage: might be both more efficient and possibly order-preserving. It uses a Heap to sort future message sends.


That's a great idea.  I'll look into that this weekend.

The alarm heap isn't order-preserving as-is.  However, if we add a sequence number to MorphicAlarm and include it in the sort-block (as is done for replicated Croquet messages), then it will be.  I like this a lot... we'll be improving existing code in Morphic instead of adding another queue.

Implementation detail: I'll probably have to use an #addDeferredUIMessage: to send the #addAlarm:withArguments:for:at:, since access to the alarm heap isn't synchronized. 

Thanks,
Josh




- Bert -