Now the mystery transitions
Delete are defined.
The reason why these transitions have no start state is
because they are taken no matter the current state. Well,
Stop: If a task is still alive ( in the
Blockedstate), then it must immediately transition to the stopping state. If a task is not alive (in the other three states), this transition is ignored because the task is no longer alive.
Block: If a task is either
Running, then it transitions to the
Blockedstate. Otherwise this request is ignored.
Delete: If a task is in any state other than
Deleted, then it must transition to the
SMC provides two ways to define default transitions:
Default state and the
Manual section 2
Default state and
transition work. Go there to learn more about them.
Task.sm is updated with the default
Delete transition definitions:
methods are added to the
There is one more improvement to the FSM that needs to be
made before we finish. Notice that the
Running state's transitions must stop the
slice timer. If a new transtion is added to
Running, the developer must remember to
stopSliceTimer() action. This is
a potential problem because a different developer
maintaining this FSM may not know about this. But there is
a solution to this.