|
|
|
|
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, you can implement a stop system via ThreadEnd. You have the ability to:
- declare a Boolean global variable in the main thread (gbEnd for example). This variable determines whether the secondary thread must be stopped.
- in the secondary thread, check the value of the variable. If it is set to True, use ThreadEnd to end 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 boolean 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() ...
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|