Difference between revisions of "Extensions.EventHandling.CloseEventSource"

From emotive
Jump to navigation Jump to search
 
(6 intermediate revisions by one other user not shown)
Line 5: Line 5:
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
EventHandling.CloseEventSource(EventSourceVariable);
+
EventHandling.CloseEventSource({EventSourceVariable[ ] source});
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
The OTX '''CloseEventSource''' action shall close and dispose given event sources. Closed event sources will no more queue any events.
+
The OTX '''CloseEventSource''' action will close and dispose given event sources. Closed event sources will no more queue any events.
  
 
Once closed, an event source can not be reopened. Using a closed event source e.g. in a [[Extensions.EventHandling.WaitForEvent|WaitForEvent]] action is an error and will cause an [[Core.DataTypes.ComplexDataType.InvalidReferenceException|otx:InvalidReferenceException]] (through the EventSourceValue term).
 
Once closed, an event source can not be reopened. Using a closed event source e.g. in a [[Extensions.EventHandling.WaitForEvent|WaitForEvent]] action is an error and will cause an [[Core.DataTypes.ComplexDataType.InvalidReferenceException|otx:InvalidReferenceException]] (through the EventSourceValue term).
  
In case that '''CloseEventSource''' is applied to an event source which is already closed, the action shall perform nothing (NOP)
+
In case that '''CloseEventSource''' is applied to an event source which is already closed, the action will perform nothing (NOP)
  
{{Note|CAUTION — In [[Core.Actions.Parallel|Parallel]] execution, situations may occur where an event source gets closed by a '''CloseEventSource''' action while being used in a [[Extensions.EventHandling.WaitForEvent|WaitForEvent]] action (in another parallel lane). If the WaitForEvent action has no other event sources registered, this will cause a deadlock situation. OTX authors should avoid such situations by careful test sequence design and the usage of the MutexGroup node.}}
+
{{Note|CAUTION — In [[Core.Actions.Parallel|Parallel]] execution, situations may occur where an event source gets closed by a '''CloseEventSource''' action while being used in a [[Extensions.EventHandling.WaitForEvent|WaitForEvent]] action (in another parallel lane). If the [[Extensions.EventHandling.WaitForEvent|WaitForEvent]] action has no other event sources registered, this will cause a deadlock situation. OTX authors need to avoid such situations by careful test sequence design and the usage of the [[Core.Actions.MutexGroup|MutexGroup]] node.}}
  
 
== Properties ==
 
== Properties ==
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| Source | [[Extensions.EventHandling.EventSource|EventSource]] | [[Variable]] | - | [1] | This represents one or more variables which contain the event sources that shall be closed.}}
+
{{TableRowPropertie2| Source | [[Extensions.EventHandling.EventSource|EventSource]] | [[Variable]] | - | [1] | This represents one or more variables which contain the event sources that will be closed.}}
 
|}
 
|}
  
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 +
/// Local Declarations
 +
 
Integer Variable1 = 0;
 
Integer Variable1 = 0;
 
EventHandling.Event Event1;
 
EventHandling.Event Event1;
 
EventHandling.EventSource EventSource1;
 
EventHandling.EventSource EventSource1;
 +
 +
 +
/// Flow
  
 
EventSource1 = EventHandling.MonitorChangeEventSource(Variable1);
 
EventSource1 = EventHandling.MonitorChangeEventSource(Variable1);
Line 36: Line 41:
  
 
== See also ==
 
== See also ==
[[Extensions.EventHandling.Sleep|Sleep]]
+
[[Extensions.EventHandling.Sleep|Sleep]] <br/>
 +
[[Extensions.EventHandling.WaitForEvent|WaitForEvent]]

Latest revision as of 10:35, 12 September 2019

Classification

Name CloseEventSource
Short Description Stops the event processing all specified sources
Class Action
Extension OTX EventHandling extension
Group EventHandling related actions
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

EventHandling.CloseEventSource({EventSourceVariable[ ] source});

Description

The OTX CloseEventSource action will close and dispose given event sources. Closed event sources will no more queue any events.

Once closed, an event source can not be reopened. Using a closed event source e.g. in a WaitForEvent action is an error and will cause an otx:InvalidReferenceException (through the EventSourceValue term).

In case that CloseEventSource is applied to an event source which is already closed, the action will perform nothing (NOP)

Icons Note.png CAUTION — In Parallel execution, situations may occur where an event source gets closed by a CloseEventSource action while being used in a WaitForEvent action (in another parallel lane). If the WaitForEvent action has no other event sources registered, this will cause a deadlock situation. OTX authors need to avoid such situations by careful test sequence design and the usage of the MutexGroup node.

Properties

Name Data Type Class Default Cardinality Description
Source EventSource Variable - [1] This represents one or more variables which contain the event sources that will be closed.

OTL Examples

/// Local Declarations

Integer Variable1 = 0;
EventHandling.Event Event1;
EventHandling.EventSource EventSource1;


/// Flow

EventSource1 = EventHandling.MonitorChangeEventSource(Variable1);
Variable1 = Variable1 + 1;
EventHandling.WaitForEvent({EventSource1}, Event1);
EventHandling.CloseEventSource({EventSource1});

See also

Sleep
WaitForEvent