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 AutomaticEvent variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The AutomaticEvent type is used to manage an automatic event. An automatic event is used to simplify the synchronization between several threads.
After its opening, an "Automatic" event is automatically closed as soon as a single thread is unlocked.
Note: It is preferable to use a variable of type SignalAutomatique or ManualEvent to create a signal, 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
// THREAD PRINCIPAL
//------------------
// Définition du signal
s is AutomaticEvent
// 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éblocage du thread principal
EventOpen(s)
Declaration

Declaring an automatic event (simple syntax) Hide the details

MyVariable is AutomaticEvent
In this case, the automatic event is closed when it is created.

Declaring an automatic event (advanced syntax) Hide the details

MyVariable is AutomaticEvent(<Initial state>)
<Initial state>: 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 AutomaticEvent variables

The AutomaticEvent variables can be used to synchronize threads in functions:
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help