Class TCriticalThread (unit NTObj)

Inherits from

TObject

-because Borlands TThread class post messages to an invisible window to synchronize threads, it is unusable for TService implementation. The TCriticalThread class is similar to TThread but uses critical sections for synchronization. Field names and methods are compatible as far as possible with Borlands implementation

Constructors


Constructor Create(CreateSuspended: Boolean);



Functions

Destructor Destroy;


Procedure Resume;


Procedure Suspend;


Procedure Terminate;


Function WaitFor: Integer;


Procedure DoTerminate;


Procedure Execute;


Procedure Synchronize(Method: TThreadMethod);


Procedure CallOnTerminate;

FMethod: TThreadMethod;

Function GetPriority: TThreadPriority;


Procedure SetPriority(Value: TThreadPriority);


Procedure SetSuspended(Value: Boolean);


Properties

property FreeOnTerminate : Boolean


property Handle : THandle


property Priority : TThreadPriority


property Suspended : Boolean


property ThreadID : THandle


property ReturnValue : Integer


property Terminated : Boolean


Events

event OnTerminate : TNotifyEvent


Variables

FFinished : Boolean;


FFreeOnTerminate : Boolean;


FHandle : THandle;


FMainThreadWaiting : Boolean;


FOnTerminate : TNotifyEvent;


FReturnValue : Integer;


FSuspended : Boolean;


FTerminated : Boolean;


FThreadID : THandle;



Constructors


Constructor Create(CreateSuspended: Boolean);


Functions


Destructor Destroy;


Procedure Resume;


Procedure Suspend;


Procedure Terminate;


Function WaitFor: Integer;


Procedure DoTerminate;


Procedure Execute;


Procedure Synchronize(Method: TThreadMethod);


Procedure CallOnTerminate;

FMethod: TThreadMethod;


Function GetPriority: TThreadPriority;


Procedure SetPriority(Value: TThreadPriority);


Procedure SetSuspended(Value: Boolean);


Properties


property FreeOnTerminate : Boolean


property Handle : THandle


property Priority : TThreadPriority


property Suspended : Boolean


property ThreadID : THandle


property ReturnValue : Integer


property Terminated : Boolean


Events


event OnTerminate : TNotifyEvent


Variables


FFinished : Boolean;


FFreeOnTerminate : Boolean;


FHandle : THandle;


FMainThreadWaiting : Boolean;


FOnTerminate : TNotifyEvent;


FReturnValue : Integer;


FSuspended : Boolean;


FTerminated : Boolean;


FThreadID : THandle;