|
|
|
|
|
ExecuteMainThread (Function) In french: ExécuteThreadPrincipal Triggers the execution of a procedure in the main application thread.
UneRéponse is string
UneRéponse = ExecuteMainThread(ProcédureInteractionUtilisateur, "Message")
Syntax
<Result> = ExecuteMainThread(<WLanguage procedure> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Character string Return value of the procedure called. This value is identical to the value obtained if the procedure is run directly. <WLanguage procedure>: Procedure name Name of procedure to execute. <Parameter 1>: Optional Parameters that will be passed to the procedure. Please note: these parameters are passed by value (not by reference). <Parameter N>: Optional Parameters that will be passed to the procedure. Please note: these parameters are passed by value (not by reference). Remarks Operating mode The main thread executes the procedure when it waits for user actions. Therefore, when the main thread of an application needs to execute procedures called by ExecuteMainThread, the following rules must be complied with: - the main thread must be highly available: very short, localized critical sections, no time-consuming processing when a secondary thread may need to call function ExecuteMainThread, no waiting for synchronization objects (semaphores, signals, etc.).
- to avoid deadlocks, threads must not hold synchronization objects (critical sections, semaphores, events, etc.) when ExecuteMainThread is called.
If the main thread is executing a process, it is not interrupted and the procedure is executed when the main thread waits for a user action again. However, Multitask can be used to interrupt a long process to handle the user actions and execute 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 from a "parent" execution context. For example, a project procedure cannot be called from an external component.
- The details of the errors and exceptions from the executed procedure are retrieved in the calling thread where ExecuteMainThread is called.
- The HFSQL context used corresponds to the context of the original element to which the called procedure belongs:
- in the case of a window procedure, the HFSQL context of the window is used (independent context or not, depending on the option chosen in the description window).
- in the case of a global procedure, the project's HFSQL context is used.
Related Examples:
|
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.
|
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|