Destroying objects remotely from another task
2038 Betrachtungen
Seite:
1
Destroying objects remotely from another task
07.10.2008 16:06
Having two active classes Controller and ToBeDestroyed, it is not possible to destroy ToBeDestroyed by just calling ToBeDestroyed_Destroy() from Controller. It would not always remove the waiting timeouts and events from the queues, which could cause an undefined behavior. However, there is a simple workaround how Controller can get ToBeDestroyed to destroy itself. Controller can send en evDestroy to ToBeDestroyed . The statechart of ToBeDestroyed must in any state be able to reacto to that event, which is possible by surrounding the actual statechart with one root state. The transition triggered by evDestroy must connect the root state (defaultState) to the termination connector.

