ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Process functions / Threads, semaphores, signals and mutex
  • Declaration
  • Using the ManualEvent variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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: 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.
Example
// THREAD PRINCIPAL
//------------------
// Définition du signal
s is ManualEvent
// Lancement du thread
ThreadExecute("Thread", threadNormal, ProcThread, s)
// Code en parallèle du thread
...
// On attend le signal déclenché par le thread
EventWait(s)
// THREAD SECONDAIRE
// ----------------------
PROCEDURE ProcThread(s)

// Code dans le thread
...
// Débloque le thread principal
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:
When calling the EventOpen (or <ManualEvent variable>.Open) function, the signal remains open:
  • 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.
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help