Difference between revisions of "Core.Actions.MutexGroup"
Jump to navigation
Jump to search
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Core]] | + | {{DISPLAYTITLE:OTX '''MutexGroup'''}}[[Category:Core]] |
== 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]] | - | [[Core.Validation.CoreChk016|Core_Chk016]] }} |
+ | |||
+ | == OTL Syntax == | ||
+ | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | mutex | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | </syntaxhighlight> | ||
== Description == | == 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 [http://en.wikipedia.org/wiki/Mutual_exclusion 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 [http://en.wikipedia.org/wiki/Thread_safety Thread-safe]. | + | The OTX '''MutexGroup''' activity is used to synchronize access to data in an [[Core.Actions.Parallel|Parallel]] activity. She is as well structured as an [[Core.Actions.Group|Group]] activity, however, it prevent simultaneous execution of contained activities by more than one thread. The term [http://en.wikipedia.org/wiki/Mutual_exclusion 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 [http://en.wikipedia.org/wiki/Thread_safety Thread-safe]. |
{{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 == | ||
− | [[ | + | [[Core.Actions.Group|Group]] <br/> |
− | [[ | + | [[Core.Actions.Loop|Loop]] <br/> |
− | [[Parallel]] <br/> | + | [[Core.Actions.Parallel|Parallel]] <br/> |
− | [[Branch]] <br/> | + | [[Core.Actions.Branch|Branch]] <br/> |
− | [[Handler]] | + | [[Core.Actions.Handler|Handler]] |
Latest revision as of 08:59, 16 February 2016
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.
![]() |
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. |
OTL Examples
Integer funds;
funds = 200;
parallel
{
lane
{
funds = 0;
}
lane
{
mutex
{
if ((funds > 100))
{
Hmi.ConfirmDialog("Spend money", null, @MessageTypes:INFO, null);
}
else
{
}
}
}
}