ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Process functions / Threads, semaphores, signals and mutex
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Stops the execution of the current thread.
Example
ThreadEnd()
Syntax
ThreadEnd()
Remarks
  • If the current thread is the main thread, ThreadEnd is equivalent to EndProgram: the application is stopped.
  • To stop a secondary Thread:
    • First method:
      • Use function ThreadRequestStop from the thread to request stop. The secondary Thread will not shut down automatically.
      • The secondary Thread code must check if the stop is requested by the ThreadStopRequested function. . It must then terminate "properly" by terminating the current code or by calling the function ThreadEnd .
    • Second method: It is also possible to set up a shutdown system using the function ThreadEnd. You have the ability to:
      • In the main the thread, declare a global Variable of type Boolean. This variable determines whether the secondary thread must be stopped.
      • In the secondary thread, check the value of the variable. If this value is at , use the function ThreadEnd to end the current secondary the thread.
      • In main the thread, set the variable to True to force the secondary thread to stop.
      Example:
      // Code du thread principal

      // gbFin est la variable globale permettant de savoir si le thread secondaire doit s'arrêter
      gbFin is boolean <critical section>
      gbFin = False
      ...
      // Lancement du thread secondaire
      ThreadExécute("Thread1", threadNormal, ProcédureThread)
      ...

      // Terminaison du thread  secondaire
      gbFin = True

      // Code du thread secondaire
      ...
      IF gbFin = True THEN ThreadEnd()
      ...
Component: wd290vm.dll
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/11/2023

Send a report | Local help