PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Declaration
  • Using the ManualEvent variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The ManualEvent type is used to manage a manual signal. A manual signal is used to simplify the synchronization between several threads.
A manual signal can only be modified by EventChange.
Note: We recommend that you use an AutomaticEvent or ManualEvent variable to create a signal rather than naming it by using a character string. Indeed, using a variable allows you to:
  • manage the variable scope,
  • avoid having 2 signals with the same name in 2 different threads.
Versions 21 and later
Apple Watch This type of variable is now available in Apple Watch mode.
New in version 21
Apple Watch This type of variable is now available in Apple Watch mode.
Apple Watch This type of variable is now available in Apple Watch mode.
Example
// MAIN THREAD
//------------------
// Define the signal
s is ManualEvent
// Start the thread
ThreadExecute("Thread", threadNormal, ProcThread, s)
// Code in parallel of the thread
...
// Wait for the signal triggered by the thread
EventWait("s")
// SECONDARY THREAD
// ----------------------
PROCÉDURE ProcThread(s)

// Code in the thread
...
// Unlocks the main thread
EventOpen(s)
Declaration

Declaring a manual signal (simple syntax) Hide the details

MyVariable is ManualEvent
In this case, the manual signal is closed when it is created.

Declaring a manual signal (advanced syntax) Hide the details

MyVariable is ManualEvent(<Initial Status>)
<Initial Status>: Integer constant
Initial status of signal:
eventOpenThe signal is opened when it is created.
eventCloseThe signal is closed during its creation.
Remarks

Using the ManualEvent variables

The ManualEvent variables can be used to synchronize threads between themselves in the functions:
Versions 20 and later
EventClose
New in version 20
EventClose
EventClose
Closes a synchronization signal between several threads.
Versions 20 and later
EventOpen
New in version 20
EventOpen
EventOpen
Opens a synchronization signal between several threads.
Versions 09 and later
EventWait
New in version 09
EventWait
EventWait
Locks the current thread while waiting for the specified signal to be opened.
During a call to EventOpen, the signal remains opened:
  • all the pending threads are freed,
  • all the threads that will reach the signal later will go through without waiting.
During a call to EventClose, the signal is closed: all the threads that will reach the signal later will remain locked.
Minimum required version
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment