RAD Studio |  |

Starting and Stopping Threads
See Also
Collapse All

A thread can be started and stopped any number of times before it finishes executing. To stop a thread temporarily, call its Suspend method. When it is safe for the thread to resume, call its Resume method. Suspend increases an internal counter, so you can nest calls to Suspend and Resume. The thread does not resume execution until all suspensions have been matched by a call to Resume.

You can request that a thread end execution prematurely by calling the Terminate method. Terminate sets the thread's Terminated property to True. If you have implemented the Execute method properly, it checks the Terminated property periodically, and stops execution when Terminated is True.

See Also

Overriding the Default Priority

Checking for Termination by Other Threads

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!