|
|
|
|
|
- Declaration
- Using the ManualEvent variables
ManualEvent (Variable type) In french: SignalManuel
The ManualEvent type is used to manage a manual event. A manual event is used to simplify the synchronization between several threads. Note: It is preferable to use a variable of type AutomaticEvent or ManualEvent variable to create a signal, rather than naming it using a string. Indeed, using a variable allows you to: - manage the variable scope,
- avoid having 2 events with the same name in 2 different threads.
s is ManualEvent
ThreadExecute("Thread", threadNormal, ProcThread, s)
...
EventWait(s)
PROCEDURE ProcThread(s)
...
EventOpen(s)
Declaring a manual event (simple syntax) Hide the details
MyVariable is ManualEvent
In this case, the manual event is closed when it is created.
Declaring a manual event (advanced syntax) Hide the details
MyVariable is ManualEvent(<Initial status>)
<Initial status>: Integer constant Initial status of the event: | | eventOpen | The event is open when it is created. | eventClose | The event is closed when it is created. |
Remarks Using the ManualEvent variables The ManualEvent variables can be used to synchronize threads in the functions: - standard syntax:
| | EventClose | Closes a synchronization event between several threads. | EventOpen | Opens a synchronization event between several threads. | EventWait | Locks the current thread while waiting for the specified event to be opened. |
- prefix syntax:
- all the pending threads are freed,
- all the threads that will reach the event later will go through without waiting.
When calling the EventClose (or <ManualEvent variable>.Close) function, the signal is closed: all threads reaching the signal remain blocked.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|