State declaration
This statement is used to declare one of the possible states an object can take. The State declaration may be followed by all the WHEN and ACTION statements that apply to this state.
Format:
State :
where:
- initial_state
- is a state qualifier whose semantics depends on whether the object is associated or not. In the case of logical objects it indicates that the object must be put in the flagged state when the SM program starts up. In the case of associated objects, the flagged state is the one that the object initially assumes when a process becomes associated with it. At the SM start-up, the object may also assume this state, if the associated process is running and it has not yet specified a state itself. By default, the initial state is the first one declared.
- dead_state
- is a state qualifier which only applies to associated objects.
It designates the state to be assigned to an object when the associated process aborts or in general is not running. The behaviour of an object as well depends on whether there is a state flagged with this qualifier:
- no state is flagged
- then when the associated process aborts the object goes into a hung state that forbids any further operations. All the commands arriving to this object (including IF statements checking its state) will be put in a queue (the originating actions will be suspended) until the associated process resumes the operations. There is no means by which other objects can test this condition.
- one of the states is flagged
- then the object remains active even while the associated process is not running. The received commands are accepted and discarded (since there is no active partner); the IF statements work as usual, namely any object can check for this state