PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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 event. A manual event is used to simplify the synchronization between several threads.
A manual event can only be modified by EventChange.
Note: We recommend that you use an AutomaticEvent or ManualEvent variable to create an event rather than naming it by using a character string. Indeed, using a variable allows you to:
  • manage the variable scope,
  • avoid having 2 events 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 event
s is ManualEvent
// Start the thread
ThreadExecute("Thread", threadNormal, ProcThread, s)
// Code in parallel of the thread
...
// Wait for the event 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 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:
eventOpenThe event is opened when it is created.
eventCloseThe event is closed during its creation.
Remarks

Using the ManualEvent variables

The ManualEvent variables can be used to synchronize threads in the functions:
During a call to EventOpen (or <ManualEvent variable>.Open), the event remains open:
  • all the pending threads are freed,
  • all the threads that will reach the event later will go through without waiting.
During a call to EventClose (or <ManualEvent variable>.Close), the event is closed: all the threads that will reach the event later will remain locked.
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment