TThreadManager¶
Thread manager record.
Declaration¶
Source position: threadh.inc line 72
type
TThreadManager = record
InitManager: = function : Boolean;
DoneManager: = function : Boolean;
BeginThread: TBeginThreadHandler = function(sa: Pointer; stacksize: PtrUInt;
ThreadFunction: TThreadFunc; p: pointer;
creationFlags: DWord;
var ThreadId: TThreadID) : TThreadHandle;
EndThread: TEndThreadHandler = procedure(ExitCode: DWord);
SuspendThread: TThreadHandler = function(threadHandle: TThreadHandle) : DWord;
ResumeThread: TThreadHandler = function(threadHandle: TThreadHandle) : DWord;
KillThread: TThreadHandler = function(threadHandle: TThreadHandle) : DWord;
CloseThread: TThreadHandler = function(threadHandle: TThreadHandle) : DWord;
ThreadSwitch: TThreadSwitchHandler = procedure;
WaitForThreadTerminate: TWaitForThreadTerminateHandler = function(threadHandle: TThreadHandle;
TimeoutMs: LongInt) : DWord;
ThreadSetPriority: TThreadSetPriorityHandler = function(threadHandle: TThreadHandle;
Prio: LongInt) : Boolean;
ThreadGetPriority: TThreadGetPriorityHandler = function(threadHandle: TThreadHandle)
: LongInt;
GetCurrentThreadId: TGetCurrentThreadIdHandler = function : TThreadID;
SetThreadDebugNameA: TThreadSetThreadDebugNameHandlerA = procedure(threadHandle: TThreadID;
const ThreadName: AnsiString);
SetThreadDebugNameU: TThreadSetThreadDebugNameHandlerU = procedure(threadHandle: TThreadID;
const ThreadName: UnicodeString);
InitCriticalSection: TCriticalSectionHandler = procedure(var cs);
DoneCriticalSection: TCriticalSectionHandler = procedure(var cs);
EnterCriticalSection: TCriticalSectionHandler = procedure(var cs);
TryEnterCriticalSection: TCriticalSectionHandlerTryEnter = function(var cs) : LongInt;
LeaveCriticalSection: TCriticalSectionHandler = procedure(var cs);
InitThreadVar: TInitThreadVarHandler = procedure(var offset: DWord; size: DWord);
RelocateThreadVar: TRelocateThreadVarHandler = function(offset: DWord) : pointer;
AllocateThreadVars: TAllocateThreadVarsHandler = procedure;
ReleaseThreadVars: TReleaseThreadVarsHandler = procedure;
BasicEventCreate: TBasicEventCreateHandler = function(EventAttributes: Pointer;
AManualReset: Boolean;
InitialState: Boolean;
const Name: ansistring)
: PEventState;
BasicEventDestroy: TBasicEventHandler = procedure(state: PEventState);
BasicEventResetEvent: TBasicEventHandler = procedure(state: PEventState);
BasicEventSetEvent: TBasicEventHandler = procedure(state: PEventState);
BasiceventWaitFOr: TBasicEventWaitForHandler = function(timeout: Cardinal;
state: PEventState;
FUseComWait: Boolean=False)
: LongInt;
RTLEventCreate: TRTLCreateEventHandler = function : PRTLEvent;
RTLEventDestroy: TRTLEventHandler = procedure(AEvent: PRTLEvent);
RTLEventSetEvent: TRTLEventHandler = procedure(AEvent: PRTLEvent);
RTLEventResetEvent: TRTLEventHandler = procedure(AEvent: PRTLEvent);
RTLEventWaitFor: TRTLEventHandler = procedure(AEvent: PRTLEvent);
RTLEventWaitForTimeout: TRTLEventHandlerTimeout = function(AEvent: PRTLEvent; timeout: LongInt)
: Boolean;
InitMultiThreading: TInitMultiThreadingHandler = procedure;
end;
Description¶
TThreadManager is a record that contains all callbacks needed for the thread handling routines of the Free Pascal Run-Time Library. The thread manager can be set by the SetThreadManager procedure, and the current thread manager can be retrieved with the GetThreadManager procedure.
The Windows RTL will set the thread manager automatically to a system thread manager, based on the Windows threading routines. Unix operating systems provide a unit cthreads which implements threads based on the C library POSIX thread routines. It is not included by default, because it would make the system unit dependent on the C library.
For more information about thread programming, see the programmer's guide.
See also¶
| Name | Description |
|---|---|
| GetThreadManager | Return the current thread manager. |
| SetThreadManager | Set the thread manager, optionally return the current thread manager. |