TIdBaseThread
Implements the ancestor for Indy thread classes.
TIdBaseThread = class(TThread)
Unit
Description
TIdBaseThread is a TThread descendant that implements the ancestor for Indy thread classes. TIdBaseThread exposes protected properties of the ancestor class including
ReturnValue and
Terminated. TIdBaseThread also provides overloaded implementations of the
Synchronize method.
Numeric result from the executing thread.
Description
ReturnValue is a public Integer property that represents the value returned to other threads or the application main thread when the thread completes executing. ReturnValue indicates success, failure, or the simple numeric result for the thread. ReturnValue is the value returned by the WaitFor method.
Indicates the thread has been asked to terminate.
Description
Terminated is a Boolean property used to indicate that the thread has been asked to abort thread execution using Terminate. The Execute method, and any methods that Execute calls, should check Terminated periodically and exit when it's True.
The Terminate method sets the Terminated property to True. The Terminate method is the polite way to abort the execution of a thread, but it requires cooperation from the thread’s Execute code. Using Terminate is recommended over the TerminateThread Win32 API call.
Executes a method call within the main VCL thread.
Parameters
Method: TThreadMethod
Method or thread method to be executed.
Description
Synchronize is an overloaded method in
TIdBaseThread that causes the code in Method to be executed in the context of the the main VCL thread. Synchronize is used to avoid conflicts in multithreaded applications by insuring that a non-thread-safe method is called from the main thread of execution. Execution of the thread is suspended while Method is executing in the main VCL thread.
Notes
You can also protect unsafe methods using critical sections or the multi-read exclusive-write synchronizer.
Executes a method call within the main VCL thread.
procedure Synchronize(Method: TThreadMethod); overload;
procedure Synchronize(Method: TMethod); overload;
Parameters
Method: TThreadMethod
Method or thread method to be executed.
Description
Synchronize is an overloaded method in
TIdBaseThread that causes the code in Method to be executed in the context of the the main VCL thread. Synchronize is used to avoid conflicts in multithreaded applications by insuring that a non-thread-safe method is called from the main thread of execution. Execution of the thread is suspended while Method is executing in the main VCL thread.
Notes
You can also protect unsafe methods using critical sections or the multi-read exclusive-write synchronizer.