PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Declaration
  • Using the AutomaticEvent 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 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: 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 AutomaticEvent
// 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
...
// Unlock the main thread
EventOpen(s)
Declaration

Declaring an automatic signal (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 Status>)
<Initial Status>: Integer constant
Initial status of the signal:
eventOpenThe event is open when it is created.
eventCloseThe signal is closed during its creation.
Remarks

Using the AutomaticEvent variables

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