Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Multi-threading - Forks and Joins
The Model Simulator provides the ability to handle multi-threaded simulations using Fork and Join nodes.
- In the example, the current execution point has forked into two threads, each with its own active node
- As this example progresses, the lower branch will wait at the Join node until the top branch has completed all its Actions
- Once the two threads merge back into one, the Simulation will continue as a single thread until completion
- When automatically stepping, each thread will be seen to execute a single step during one simulation 'cycle' - although when single stepping or at a breakpoint, the behavior is to alternate step between threads as each thread receives processing time
- Note that the Call Stack window will show two active threads and one 'paused' thread in the example; once the threads merge there will be a return to single threaded execution
- Also note that the Local variables are shared (global) between all threads; if you want to Simulate private variables on a thread you must create new Simulation variables at the start of each thread - pre-loading such variables with existing global data