Multi-threading - Concurrent State Regions
Concurrent regions within a state represent state changes and processing that occurs in parallel inside one overall parent state. This is especially useful when one region raises events or modifies simulation variables that another region is dependent on. For example, one region could contain a simulated timer which raised events on set intervals that invoked state changes in the states within other regions.
Concurrent regions are essentially the same as Forks and Joins with similar logic and processing rules.
In the example below,
|•||When the transition to SalesProcess is taken, each region is concurrently activated.|
|•||Credit is checked, the order totalled and the goods required packed up.|
|•||However, in the event that the CreditCheck fails, this triggers the transition to the Sale Cancelled state. Note that when this occurs, the entire parent state and all owned regions are immediately exited, regardless of their processing state.|
|•||If the Credit Check succeeds, the region moves to the final state and once the other regions have all reached their own final state, the parent state can then be exited.|