Difference between revisions of "Extensions.EventHandling.WaitForEvent"
Jump to navigation
Jump to search
(5 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.WaitForEvent(EventSourceTerm, EventVariable); | + | EventHandling.WaitForEvent({EventSourceTerm[ ] source}, EventVariable event); |
</syntaxhighlight> | </syntaxhighlight> | ||
== Description == | == Description == | ||
− | The OTX '''WaitForEvent''' action | + | The OTX '''WaitForEvent''' action will block the thread of execution until it receives an event from one of its event sources. As soon as an event becomes available in one of the sources' event queues, '''WaitForEvent''' will remove that event from the event source's queue and exit; the thread of execution continues to the next node. |
If an event variable was specified, the event that caused '''WaitForEvent''' to exit is assigned to the variable. | If an event variable was specified, the event that caused '''WaitForEvent''' to exit is assigned to the variable. | ||
Line 16: | Line 16: | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{TableRowPropertie1| Event | [[Extensions.EventHandling.Event|Event]] | [[Variable]] | - | [0..1] | This optional element represents an '''Event'''-type variable which | + | {{TableRowPropertie1| Event | [[Extensions.EventHandling.Event|Event]] | [[Variable]] | - | [0..1] | This optional element represents an '''Event'''-type variable which will receive the event that terminates this wait.}} |
− | {{TableRowPropertie2| Source | [[Extensions.EventHandling.EventSource|EventSource]] | [[Term]] | - | [1..*] | This represents one or more event sources that the action | + | {{TableRowPropertie2| Source | [[Extensions.EventHandling.EventSource|EventSource]] | [[Term]] | - | [1..*] | This represents one or more event sources that the action will wait for. The wait will be terminated by the first source to fire an event.}} |
|} | |} | ||
== 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 Integer1; | ||
EventHandling.EventSource EventSource1; | EventHandling.EventSource EventSource1; | ||
+ | EventHandling.Event Event1; | ||
+ | |||
+ | /// Flow | ||
+ | |||
+ | EventSource1 = EventHandling.MonitorChangeEventSource(Integer1); | ||
− | |||
parallel | parallel | ||
{ | { | ||
− | + | lane | |
− | + | { | |
− | + | EventHandling.WaitForEvent({EventSource1}, Event1); | |
− | + | } | |
− | + | lane | |
− | + | { | |
− | + | EventHandling.Sleep(500); | |
− | + | Integer1 = 13; | |
+ | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See also == | == See also == | ||
+ | [[Extensions.EventHandling.Sleep|Sleep]]<br/> | ||
[[Extensions.EventHandling.CloseEventSource|CloseEventSource]] | [[Extensions.EventHandling.CloseEventSource|CloseEventSource]] |
Latest revision as of 10:35, 12 September 2019
Classification
Name | WaitForEvent |
Short Description | Wait until an event is triggered and then continues processing |
Class | Action |
Extension | OTX EventHandling extension |
Group | EventHandling related actions |
Exceptions | - |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
EventHandling.WaitForEvent({EventSourceTerm[ ] source}, EventVariable event);
Description
The OTX WaitForEvent action will block the thread of execution until it receives an event from one of its event sources. As soon as an event becomes available in one of the sources' event queues, WaitForEvent will remove that event from the event source's queue and exit; the thread of execution continues to the next node.
If an event variable was specified, the event that caused WaitForEvent to exit is assigned to the variable.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Event | Event | Variable | - | [0..1] | This optional element represents an Event-type variable which will receive the event that terminates this wait. |
Source | EventSource | Term | - | [1..*] | This represents one or more event sources that the action will wait for. The wait will be terminated by the first source to fire an event. |
OTL Examples
/// Local Declarations
Integer Integer1;
EventHandling.EventSource EventSource1;
EventHandling.Event Event1;
/// Flow
EventSource1 = EventHandling.MonitorChangeEventSource(Integer1);
parallel
{
lane
{
EventHandling.WaitForEvent({EventSource1}, Event1);
}
lane
{
EventHandling.Sleep(500);
Integer1 = 13;
}
}