Class TSeparateThread (unit Threads)

Inherits from

TThread

Thread that will run on a stack seperate from the main root thread. The stack is allocated from the local stack when AllocateStackGlobal is false and otherwise is allocated from the global stack (default).

Constructors


constructor Create(aThreadProc: TThreadProc; aStackSize: Word; aMinSliceTicks: LongInt);

**************************************************************************** SeparateThread

constructor Launch(aThreadProc: TThreadProc; aStackSize: Word; aMinSliceTicks: LongInt);

Initialize the threads code pointer.


Functions

destructor Destroy;


procedure Run;


procedure SynchronizeMethod(aMethod: TSyncMethodEvent; aWait: Boolean);

AllocateHWnd returns 0 if not successfull

procedure Terminate;

and switch out to another thread.

function AllocateStack( aStackSize: Word; var aStackTop: Pointer): THandle;

and de-allocate window handle

procedure DeallocateStack( aStackHandle: THandle);


procedure DoSynchronize( aEvent: Word; aWait: Boolean);


function GetSynchronizeEvents: Boolean;


procedure SetSynchronizeEvents(Value: Boolean);


procedure WndProc(var Msg: TMessage);


Properties

property Terminated : Boolean


Events

event OnException : TExceptionEvent


Variables

FGlobalAllocatedStack : Boolean;


FOnException : TExceptionEvent;


FStackHandle : THandle;


FTerminated : Boolean;


FThreadProc : TThreadProc;


FDispatched : Boolean;


FOnSyncMethod : TSyncMethodEvent;


FWindowhandle : THandle;



Constructors


constructor Create(aThreadProc: TThreadProc; aStackSize: Word; aMinSliceTicks: LongInt);

**************************************************************************** SeparateThread


constructor Launch(aThreadProc: TThreadProc; aStackSize: Word; aMinSliceTicks: LongInt);

Initialize the threads code pointer.


Functions


destructor Destroy;


procedure Run;


procedure SynchronizeMethod(aMethod: TSyncMethodEvent; aWait: Boolean);

AllocateHWnd returns 0 if not successfull


procedure Terminate;

and switch out to another thread.


function AllocateStack( aStackSize: Word; var aStackTop: Pointer): THandle;

and de-allocate window handle


procedure DeallocateStack( aStackHandle: THandle);


procedure DoSynchronize( aEvent: Word; aWait: Boolean);


function GetSynchronizeEvents: Boolean;


procedure SetSynchronizeEvents(Value: Boolean);


procedure WndProc(var Msg: TMessage);


Properties


property Terminated : Boolean


Events


event OnException : TExceptionEvent


Variables


FGlobalAllocatedStack : Boolean;


FOnException : TExceptionEvent;


FStackHandle : THandle;


FTerminated : Boolean;


FThreadProc : TThreadProc;


FDispatched : Boolean;


FOnSyncMethod : TSyncMethodEvent;


FWindowhandle : THandle;