Core.Actions.Parallel
Jump to navigation
Jump to search
Classification
Name | Parallel |
Short Description | Simultaneous processing of two or more branches (Threading) |
Class | Compound Node |
Extension | OTX Core library |
Group | Compund node related actions |
Exceptions | - |
Checker Rules | Core_Chk015 |
Standard Compliant | Yes |
OTL Syntax
parallel
{
lane
{
...
}
...
}
Description
The OTX parallel activity consists of two or more sequences (lanes) which at the same time are processed. At run time, a Thread is started for each branch. The normal run-time behavior of the parallel activity is synchronous. This means that the activity will leave only if all included branches (lanes) is completed.
Important: The run-time behavior of the branches is indeterminate. To avoid a branch within the activity should not depend on Race Conditions from one another! |
Important: To guarantee the Thread safety, we recommend that you work within the branch with the MutexGroup activity! |
Then, usually a parallel activity terminates when all contained branches have exits. There are still three more rules for the special termination of parallel activities:
- TerminateLanes activity
- All other sectors included in the parallel activity is the TerminateLanes activity is executed in a branch, is signaled to exit. The other branches run completely yet just in the processing activity:
- MutexGroup
- FinallyBlock
- ActionNodes
- EndNodes
- Then, the branch is terminated by the following activities to skip.
Important: A branch is currently in a ProcedureCall activity, the invoked procedure terminates prematurely, after completion of the current activity. |
Important: Please keep in mind that no time-out exists for the termination of the currently in-progress activities. There is a risk for the production of Deadlocks! |
- Return activity
- The return activity from running in a branch, only this branch terminates immediately. The parallel activity waits for then all contained branches have finished up and then closes the entire procedure.
- An unhandled exception occurs
- An exception in a branch of is thrown, which is not handled within the branch, this branch is terminated immediately. The parallel activity waits then until all contained branches have exited. Then, the exception is propagated to the next higher level of processing. More than an exception thrown, only the first exception is propagated.
OTL Examples
Integer funds;
funds = 200;
parallel
{
lane
{
funds = 0;
}
lane
{
mutex
{
if ((funds > 100))
{
Hmi.ConfirmDialog("Spend money", null, @MessageTypes:INFO, null);
}
else
{
}
}
}
}