PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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 application thread.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Versions 19 and later
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Windows Mobile This function is now available for the Windows Mobile applications.
New in version 19
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Windows Mobile This function is now available for the Windows Mobile applications.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Windows Mobile This function is now available for the Windows Mobile applications.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
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 address).
<Parameter N>: Optional
Parameters that will be passed to the procedure. Caution: these parameters are passed by value (and not by address).
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, signals, ...).
  • the call to ExecuteMainThread from the threads must be done without "keeping" synchronization objects (critical sections, semaphores, signals, ...) 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.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230wm.dll
Windows Mobile wp230wm.dll
Linux wd230wm.so
Android wd230android.jar
Minimum required version
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment