Difference between revisions of "Core.Actions.MutexGroup"

From emotive
Jump to navigation Jump to search
Line 2: Line 2:
 
== Classification ==
 
== Classification ==
 
{{ClassificationActivity | MutexGroup | To synchronize the access to data in a parallel activity | [[Compound Node]] | [[Core|OTX Core library]] | [[Compound node related actions]] | - | [[CoreChk016|Core_Chk016]] }}
 
{{ClassificationActivity | MutexGroup | To synchronize the access to data in a parallel activity | [[Compound Node]] | [[Core|OTX Core library]] | [[Compound node related actions]] | - | [[CoreChk016|Core_Chk016]] }}
 +
 +
== OTL Syntax ==
 +
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 +
mutex
 +
{
 +
  ...
 +
}
 +
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
Line 8: Line 16:
 
{{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.}}
 
{{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.}}
 
{{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.}}
 
{{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 ==
 +
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 +
Integer funds;
 +
 +
funds = 200;
 +
parallel
 +
{
 +
  lane
 +
  {
 +
      funds = 0;
 +
  }
 +
  lane
 +
  {
 +
      mutex
 +
      {
 +
        if ((funds > 100))
 +
        {
 +
            Hmi.ConfirmDialog("Spend money", null, @MessageTypes:INFO, null);
 +
        }
 +
        else
 +
        {
 +
        }
 +
      }
 +
  }
 +
}
 +
</syntaxhighlight>
  
 
== See also ==
 
== See also ==

Revision as of 03:25, 3 February 2015

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

Loop
Group
Parallel
Branch
Handler