Indy 9 | Content | Index | Reference

TIdBaseThread
Hierarchy, Properties, Methods, See Also, Unit: IdThread
Implements the ancestor for Indy thread classes.

    TIdBaseThread = class(TThread)

Unit
IdThread
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.

TIdBaseThread.ReturnValue
TIdBaseThread, See Also
Numeric result from the executing thread.

    property ReturnValue;

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.

TIdBaseThread.Terminated
TIdBaseThread
Indicates the thread has been asked to terminate.

    property Terminated;

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.

TIdBaseThread.Synchronize
TIdBaseThread
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.

TIdBaseThread.Synchronize
TIdBaseThread
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.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.