PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Operating mode
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
Triggers the execution of a procedure by the main thread of the application.
Versions 19 and later
Linux This function is now available for WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for WEBDEV sites in Linux.
New in version 19
Linux This function is now available for WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for WEBDEV sites in Linux.
Linux This function is now available for WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for WEBDEV sites in Linux.
Example
// Interact with the user
AnAnswer is string
AnAnswer = ExecuteMainThread(UserInteractionProcedure, "Message")
Syntax
<Result> = ExecuteMainThread(<Procedure> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Character string
Return value of procedure called. This value is identical to the value obtained if the procedure is run directly.
<Procedure>: Character string
Name of procedure to run.
<Parameter 1>: Optional
Parameters that will be passed to the procedure. Caution: these parameters are passed by value (and not by reference).
<Parameter N>: Optional
Parameters that will be passed to the procedure. Caution: these parameters are passed by value (and not by reference).
Remarks

Operating mode

The procedure execution is performed by the main thread when this one is waiting for interactions with the user.
Therefore, when the main application thread must run procedures called by ExecuteMainThread, the following rules must be complied with:
  • the main thread must be highly available: sort and localized critical sections, no long process when a secondary thread may have to call ExecuteMainThread, no wait for synchronization objects (semaphores, events, etc.).
  • the call to ExecuteMainThread from the threads must be done without "keeping" synchronization objects (critical sections, semaphores, events, ...) to avoid a deadlock.
If the main thread is running a process, this process is not interrupted and the procedure will be run when the main thread switches back to waiting for interaction with the user.
However, Multitask allows you to interrupt a long process in order to process the user actions and to run the procedures called by ExecuteMainThread.
The call to ExecuteMainThread is locking as long as the procedure was not run by the main thread.
Caution:
  • ExecuteMainThread cannot be used to call a procedure of "parent" execution context. For example, a project procedure cannot be called from an external component.
  • The errors and the exceptions coming from the procedure run are carried over to the calling thread during the call to ExecuteMainThread.
Related Examples:
Using parallel tasks Unit examples (WINDEV): Using parallel tasks
[ + ] The parallel tasks are used to speed up the process times and to improve the reactivity of an application.
This example presents the functions and types of variables required to use the parallel tasks:
- running parallel tasks,
- interaction with the controls,
- continuation tasks.
Component : wd240wm.dll
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment