Core.Actions.MutexGroup

From emotive
Jump to navigation Jump to search

Classification

Name MutexGroup
Short Description To synchronize the access to data in a parallel activity
Class Compound Node
Extension OTX Core library
Group Compound node related actions
Exceptions -
Checker Rules Core_Chk016
Standard Compliant Yes

OTL Syntax

mutex
{
   ...
}

Description

The OTX MutexGroup activity is used to synchronize access to data in an Parallel activity. She is as well structured as an Group activity, however, it prevent simultaneous execution of contained activities by more than one thread. The term Mutex means "mutual exclusion" or mutual exclusion. So always just a MutexGroup can run. Thus can be used to ensure that shared data not uncoordinated can be changed, see Thread-safe.

Exclamation.png Important: If in different lanes of a parallel activity reading or writing data is accessed, the range in a MutexGroup activity should be. Read-only, no MutexGroup is necessary.
Exclamation.png Important: Please keep in mind that the MutexGroup has strong influence on the performance of a parallel activity and use it only where it is to the described problems can occur.

OTL Examples

Integer funds;

funds = 200;
parallel
{
   lane
   {
      funds = 0;
   }
   lane
   {
      mutex
      {
         if ((funds > 100))
         {
            Hmi.ConfirmDialog("Spend money", null, @MessageTypes:INFO, null);
         }
         else
         {
         }
      }
   }
}

See also

Group
Loop
Parallel
Branch
Handler