The TThread Object

Delphi encapsulates the API thread object into an Object Pascal object called TThread. Although TThread encapsulates almost all the commonly used thread API functions into one discrete object, there are some points—particularly those dealing with thread synchronization—in which you have to use the API. In this section, you learn how the TThread object works and how to use it in your applications.

TThread Basics

The TThread object is found in the Classes unit and is defined as follows:

							 TThread = class private FHandle: THandle; {$IFDEF MSWINDOWS} FThreadID: THandle; {$ENDIF} {$IFDEF LINUX} // ** FThreadID is not THandle in Linux ** FThreadID: Cardinal; FCreateSuspendedSem: TSemaphore; FInitialSuspendDone: Boolean; {$ENDIF} ...

Get Borland® Delphi™ 6 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.