<html>Sziasztok!<br /><br />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.<br /><br />Üdv,<br /> Máté<br /><br />2015 Június 19, Péntek 20:43 CEST dátummal, Boldizsár Németh <nboldi@caesar.elte.hu> ezt írta:<br /> <blockquote type="cite" cite="558462D6.2060404@caesar.elte.hu">Sziasztok!<br /><br />Nekem korrektnek tűnik ez az elvárás.<br />Egy kérdés: ha egy state machine csak simán kifogy az eventekből de nem<br />ér el terminálási állapotot, akkor ott beragad, és amíg ott van addig a<br />rendszer sem terminál, ha jól értem. Tehát célszerű lesz úgy átírni a<br />példákat, hogy terminálási állapotba jussanak.<br />Gergő, te mit gondolsz?<br /><br />Boldi<br /><br />On 2015.06.19. 12:14, modelinterpreter-trac@plc.inf.elte.hu wrote:<br />> #248: Change runtime event queue and termination condition<br />> --------------------------+----------------------------<br />> Reporter: kmate | Owner: nboldi<br />> Type: defect | Status: new<br />> Priority: major | Milestone: 2015-06 (June)<br />> Component: Code_Runtime | Version:<br />> Keywords: |<br />> --------------------------+----------------------------<br />> Currently the runtime uses a simple linked list with a queue interface to<br />> represent the event queue of the state machine(s) in a single component.<br />> When the queue gets empty, the runtime terminates immediately. This<br />> behavior should be modified as follows:<br />><br />> - The event queue should be a blocking data structure, which suspends the<br />> dispatching thread until an event arrives (eg.<br />> [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/LinkedBlockingDeque.html<br />> LinkedBlockingDeque])<br />> - The runtime must terminate only after all active class instances are<br />> destroyed. A class is active when it has a state machine, and it could be<br />> destroyed in two ways:<br />> - its state machine reaches a final pseudo state<br />> - it is destroyed explicitly from action code (to be supported later)<br />> - An instance registry could watch for these destructions and terminate<br />> the runtime if there are no more active class instances in it<br />> - As there is no concurrency in a single component, the blocking of the<br />> event handler queue is not a problem, as the destruction of an active<br />> class is always executed before the queue will be checked again for more<br />> events<br />><br /> </blockquote><br /><br /><br /> </html>