Event processing: run-to-completion step

Event occurrences are detected, dispatched, and then processed by the state chart one at a time. The semantics of event processing is based on run-to-completion processing. Run-to-completion processing means that an event is processed only when the processing of the previous event is fully completed. The processing of a single event occurrence by a state chart is known as a run-to-completion step.

Before commencing a run-to-completion step, a state chart is in a stable state configuration with all entry, exit, and internal activities completed. The same conditions apply after the run-to-completion step is completed. Thus, an event will never be processed while the state chart is in an intermediate and inconsistent situation.

The run-to-completion step is the passage between two state configurations of the state chart. When an event is detected and dispatched, it may result in one or more transitions being enabled for firing. If no transition is enabled and the event is not in the deferred event list of the current state, the event is discarded and the run-to-completion step is completed.

In the presence of parallel regions, it is possible to fire multiple transitions because of the same event. If one or more transitions are enabled, the state chart selects a subset and fires them. The enabled transition that fires is determined by the transition selection algorithm. Each parallel region in the active state chart can fire at most one transition during a run step. When all regions have finished executing the transition, the current run-to-completion step is complete.