JVCL Help:TJvMTThread.CheckTerminate

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

Checks whether the thread has been asked to terminate.


Pascal

 procedureCheckTerminate;


Description

This functions checks if the thread needs to terminate. It will raise an EMTTerminate exception if the thread needs to terminate.
Call CheckTerminate to check whether the thread has been asked to terminate. If so, then the thread will terminate after the CheckTerminate call.
The thread's OnExecute handler and any methods that the handler calls should call CheckTerminate periodically. The Terminate method signals the thread that it should terminate.
procedure TJvMTThread1.OnExecute(Sender: TJvMtThread;

 MTThread: TJvMtSingleThread);
begin
while True do
begin

CurrentMTThread.CheckTerminate;
// or
Sender.CheckTerminate;

{ do something }
end;
end;


See Also

TJvMTThread.Terminate, TJvMTThread.OnTerminating


About

Notes

CheckTerminate should onlybe called in the context of the thread. Thus only call CheckTerminate of a specific TJvMTThread component in the OnExecute handler of that thread component.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page