polymurph / tinyFSM

lightweight finite state machine
MIT License
1 stars 0 forks source link

Define procedure when ending the FSM #4

Open polymurph opened 3 months ago

polymurph commented 3 months ago

Decide if the FSM ending procedure should remain as is shown here.

        case STATE_END_FSM:
            // End the finite state machine
            fsmObject->previousState = fsmObject->entryState;
            fsmObject->currentState = fsmObject->entryState;
            fsmObject->nextState = fsmObject->entryState;
            fsmObject->fsmEndingAction();
            fsmObject->state = STATE_NO_CHANGE;

            // mutex unlock
            fsmObject->mutexOps.unlock(fsmObject->mutexObject);
            return FSM_ENDED;

Here the FSM objects attributes are set to the entry state. The question is...

QUESTION: Should the attribute c fsmObject->initialized be set to 0 and thus blocking any further runing arremts? It could be reinitialized with a function c fsmReInit() which sets the attribute back to 1.