|
|
|
|
ThreadEnd (Function) In french: ThreadFin Stops the execution of the current thread. 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:
gbFin is boolean <critical section>
gbFin = False
...
ThreadExécute("Thread1", threadNormal, ProcédureThread)
...
gbFin = True
...
IF gbFin = True THEN ThreadEnd()
...
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|