commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Wienke <jwie...@techfak.uni-bielefeld.de>
Subject Re: [SCXML] onentry executable content parallel to further transitions
Date Mon, 08 Sep 2014 16:59:58 GMT
Hi,

thanks for the feedback work on this!

On 09/07/2014 10:31 PM, Ate Douma wrote:
> Actually, Commons SCXML already uses an event queue (one for internal
> events and one for external events).
> It is however the responsibility of separate client threads to only use
> the executor #addEvent methods and only use a single client thread for
> actual execution and event triggering on the state machine.
> The bug you encountered was in the Commons SCXML *internal* delivery of
> events which likewise (now) should use #addEvent but still used the
> #triggerEvent method instead. This should now be fixed.

Ok, assuming I am always using addEvents to fill the event queue, what
is the correct pattern for a worker thread that then calls
triggerEvents()? As far as I can tell from the implementation, this
method returns immediately in case the queue is currently empty. Hence,
implementing something like
while (true) {
    executor.triggerEvents();
}
should result in a loop wasting one CPU in case no external events need
to be processed? This sounds wrong to me.

Cheers,
Johannes

-- 
Johannes Wienke, Researcher at CoR-Lab / CITEC, Bielefeld University
Address: Inspiration 1, D-33619 Bielefeld, Germany (Room 1.307)
Phone: +49 521 106-67277


Mime
View raw message