ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Process functions / Threads, semaphores, signals and mutex
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
ThreadEnd (Function)
In french: ThreadFin
Stops the execution of the current thread.
Example
ThreadEnd()
Syntax
ThreadEnd()
Remarks
  • If the current thread is the main thread, both ThreadEnd and EndProgram stop the application.
  • To stop a secondary thread:
    • First method:
      • Call ThreadRequestStop from the thread that should request the stop. The secondary thread will not be stopped automatically.
      • The code of the secondary thread must use ThreadStopRequested to check if the stop has been requested. If so, the thread must be properly stopped by terminating the current code or by calling ThreadEnd.
    • Second method: Implement a stop system using ThreadEnd. You have the ability to:
      • Declare a global variable of type Boolean in the main thread. This variable determines whether the secondary thread must be stopped.
      • In the secondary thread, check the value of the variable. If this value is set to True, use ThreadEnd to terminate the current secondary thread.
      • In main the thread, set the variable to True to force the secondary thread to stop.
      Example:
      // Code of main thread
      // gbEnd is the global variable used to determine whether the secondary thread should stop
      gbEnd is boolean <critical section>
      gbEnd = False
      ...
      // Start the secondary thread
      ThreadExecute("Thread1", threadNormal, ThreadProcedure)
      ...
      // End the secondary thread
      gbEnd = True
      // Code of secondary thread
      ...
      IF gbEnd = True THEN ThreadEnd()
      ...
Component: wd300vm.dll
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/06/2025

Send a report | Local help