[Modelinterpreter] [Model Interpreter] #248: Change runtime event queue and termination condition
Karácsony Máté
kmate at caesar.elte.hu
Fri Jun 19 20:59:47 CEST 2015
Sziasztok!
Igen, pontosan erről van szó. A dolgot eleve az hozta felszínre, hogy készítettem egy olyan példát, ahol a switch modelt egy GUI-n lehet vezérelni 3 gombbal: turn on, turn off, hammer hit. Ha az off állapotban valaki megnyomja az off-ot, az állapotgép természetesen nem lép. Csakhogy ekkor el is fogynak az event-ek, és a runtime terminál. Pedig még kaphatna másik eseményt is a GUI-ról... Tehát a megoldás az, hogy ha egyáltalán nincs feldolgozandó esemény, akkor a következőig várunk - ezt pedig célszerű blokkolással, nem busy waiting-el megvalósítani. Nyilván az adott komponensben nem történik már semmi, de kívülről egy másik komponens, vagy ez esetben az external interface még küldhet be eseményt, amíg van érvényes aktív osztálybeli példány. A ticket a Gergővel ma lefolytatott beszélgetés eredményét rögzíti.
Üdv,
Máté
2015 Június 19, Péntek 20:43 CEST dátummal, Boldizsár Németh <nboldi at caesar.elte.hu> ezt írta:
Sziasztok!
Nekem korrektnek tűnik ez az elvárás.
Egy kérdés: ha egy state machine csak simán kifogy az eventekből de nem
ér el terminálási állapotot, akkor ott beragad, és amíg ott van addig a
rendszer sem terminál, ha jól értem. Tehát célszerű lesz úgy átírni a
példákat, hogy terminálási állapotba jussanak.
Gergő, te mit gondolsz?
Boldi
On 2015.06.19. 12:14, modelinterpreter-trac at plc.inf.elte.hu wrote:
> #248: Change runtime event queue and termination condition
> --------------------------+----------------------------
> Reporter: kmate | Owner: nboldi
> Type: defect | Status: new
> Priority: major | Milestone: 2015-06 (June)
> Component: Code_Runtime | Version:
> Keywords: |
> --------------------------+----------------------------
> Currently the runtime uses a simple linked list with a queue interface to
> represent the event queue of the state machine(s) in a single component.
> When the queue gets empty, the runtime terminates immediately. This
> behavior should be modified as follows:
>
> - The event queue should be a blocking data structure, which suspends the
> dispatching thread until an event arrives (eg.
> [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/LinkedBlockingDeque.html
> LinkedBlockingDeque])
> - The runtime must terminate only after all active class instances are
> destroyed. A class is active when it has a state machine, and it could be
> destroyed in two ways:
> - its state machine reaches a final pseudo state
> - it is destroyed explicitly from action code (to be supported later)
> - An instance registry could watch for these destructions and terminate
> the runtime if there are no more active class instances in it
> - As there is no concurrency in a single component, the blocking of the
> event handler queue is not a problem, as the destruction of an active
> class is always executed before the queue will be checked again for more
> events
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://plc.inf.elte.hu/pipermail/modelinterpreter/attachments/20150619/e043e97d/attachment.html>
More information about the Modelinterpreter
mailing list