[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'System' (#rtl)

# TThreadManager

Thread manager record.

## Declaration

Source position: threadh.inc line 58

`type TThreadManager = record`
`InitManager: function: Boolean;` |  | Initialize the thread manager.
`DoneManager: function: Boolean;` |  | Clean up the thread manager.
`BeginThread: TBeginThreadHandler;` |  | Start a new thread.
`EndThread: TEndThreadHandler;` |  | End the current thread.
`SuspendThread: TThreadHandler;` |  | Suspend a running thread.
`ResumeThread: TThreadHandler;` |  | Resumt a suspended thread.
`KillThread: TThreadHandler;` |  | Kill a running thread.
`CloseThread: TThreadHandler;` |  | Implements CloseThread.
`ThreadSwitch: TThreadSwitchHandler;` |  | Cause a threadswitch.
`WaitForThreadTerminate: TWaitForThreadTerminateHandler;` |  | Wait for a thread to stop.
`ThreadSetPriority: TThreadSetPriorityHandler;` |  | Set thread priority
`ThreadGetPriority: TThreadGetPriorityHandler;` |  | Get thread priority.
`GetCurrentThreadId: TGetCurrentThreadIdHandler;` |  | Get current thread ID
`InitCriticalSection: TCriticalSectionHandler;` |  | Initialize a critical section.
`DoneCriticalSection: TCriticalSectionHandler;` |  | Free a critical section
`EnterCriticalSection: TCriticalSectionHandler;` |  | Enter a critical section
`TryEnterCriticalSection: TCriticalSectionHandlerTryEnter;` |  | Implements TryEnterCriticalsection.
`LeaveCriticalSection: TCriticalSectionHandler;` |  | leave a critical section.
`InitThreadVar: TInitThreadVarHandler;` |  | Initialize a thread variable.
`RelocateThreadVar: TRelocateThreadVarHandler;` |  | Relocate a thread variable.
`AllocateThreadVars: TAllocateThreadVarsHandler;` |  | Allocate thread variables.
`ReleaseThreadVars: TReleaseThreadVarsHandler;` |  | Release thread variables.
`BasicEventCreate: TBasicEventCreateHandler;` |  | Create a basic event.
`BasicEventDestroy: TBasicEventHandler;` |  | Destroy a basic event.
`BasicEventResetEvent: TBasicEventHandler;` |  | Reset a basic event.
`BasicEventSetEvent: TBasicEventHandler;` |  | Set a basic event
`BasiceventWaitFOr: TBasicEventWaitForHandler;` |  | Wait for a basic event
`RTLEventCreate: TRTLCreateEventHandler;` |  | Create an RTL event
`RTLEventDestroy: TRTLEventHandler;` |  | Free an RTL event
`RTLEventSetEvent: TRTLEventHandler;` |  | Set an RTL event
`RTLEventResetEvent: TRTLEventHandler;` |  | Reset an RTL event
`RTLEventWaitFor: TRTLEventHandler;` |  | Wait for an RTL event.
`RTLEventSync: TRTLEventSyncHandler;` |  | Synchronize an RTL event.
`RTLEventWaitForTimeout: TRTLEventHandlerTimeout;` |  | Wait for RTL event, with timeout.
`SemaphoreInit: TSempahoreInitHandler;` |  | Initialize (create) a new semaphore
`SemaphoreDestroy: TSemaphoreDestroyHandler;` |  | Destroy (free) a semaphore created using SemaphoreInit.
`SemaphorePost: TSemaphorePostHandler;` |  | Post an event on a semaphore created using SemaphoreInit.
`SemaphoreWait: TSemaphoreWaitHandler;` |  | Wait on a semaphore event posted by SemaphorePost.
`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

GetThreadManager |  | Return the current thread manager
SetThreadManager |  | Set the thread manager, optionally return the current thread manager.

Documentation generated on: Feb 26 2014