W3C home > Mailing lists > Public > www-voice@w3.org > January to March 2013

Re: revised mainEventLoop

From: David Junger <tffy@free.fr>
Date: Fri, 8 Mar 2013 19:47:46 +0100
Message-Id: <1D9DF739-95C9-4EA8-956C-5B4B34DA891E@free.fr>
To: "www-voice@w3.org (www-voice@w3.org)" <www-voice@w3.org>
Le 8 mar 2013 à 18:57, chris nuernberger a écrit :

> I see what you are saying and you are correct as far as I can tell, this is more efficient.  Don't you need a second while loop for external events that gets called if enabled transitions is empty?

Yes, I was just proposing a modification to the inner loop that handles targetless transitions and internal events and didn't write the context.

> Although depending on your state machine your conditions could check for time differences or some other externally updating information source.  This would mean you would want to poll the eventless transitions again.

Yes, it is possible to raise a hundred thousand useless events and look at the time in a eventless transition's condition, but seriously? for benchmarking that would be irrelevant, and for anything else it is silly. If you need ticks you can instead have a "clock" state generating events at regular intervals with delayed sends and some offset correction, or, for more precision, extend the platform to provide those events.
Internal events should dequeue so fast that you shouldn't expect (and the platform should not push, to prevent race conditions) external modifications to the datamodel during that time. Besides, if your SC is polling external data (rather than listening for mutation events!) with an eventless transition whose repetition depends on stuffing the internal queue with junk events, you deserve to have your code broken in a horrible way :p

Received on Friday, 8 March 2013 18:48:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:07:43 UTC