ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Process functions / Threads, semaphores, signals and mutex
  • Declaration
  • Using the ManualEvent variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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.
Remark: We recommend that you use an AutomaticEvent or ManualEvent variable to create an event rather than naming it 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.
Example
// MAIN THREAD
//------------------
// Define the event
s is ManualEvent
// Start the thread
ThreadExecute("Thread", threadNormal, ProcThread, s)
// Code in parallel with the thread
...
// Wait for the event triggered by the thread
EventWait("s")
// SECONDARY THREAD
// ----------------------
PROCEDURE 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 open when it is created.
eventCloseThe event is closed when it is created.
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

Last update: 06/21/2023

Send a report | Local help