Internet Direct (Indy)
Home
PreviousUpNext
TIdThread.Create Constructor

Constructor for the TIdThread instance.

Pascal
constructor Create(
    ACreateSuspended: Boolean = True; 
    ALoop: Boolean = True; 
    AName: string = ''
); virtual;
Parameters 
Description 
ACreateSuspended 
Create thread in a suspended state.
 
ALoop 
Indicates Run is called in an inner loop.
 
AName 
Name to assign for the executing thread. 

Create is the constructor for the TIdThread instance. Create calls the inherited constructor to initialize the thread instance. 

Create sets the default values in the Options property to include itoDataOwner which indicates the the Data property is managed by the thread instance. 

The value itoStopped is also included in Options when the thread is created in a suspended state, as indicated by the value in ACreateSuspended. 

When ACreateSuspended contains True, call the Start method in order to start execution of thread. If ACreateSuspended contains False, the thread automatically starts executing upon successful completion of the constructor. 

Arguments in the ALoop and AName parameters are assigned to the Loop and Name properties (respectively). 

Create allocates the internal critical section member variable used to provide thread-safe access to property values in the thread instance. 

Create increments the unit global variable GThreadCount to track the number of active TIdThread instances created by an application. 

Use Destroy to decrement the number of active threads in the unit global variable GThreadCount, and to free resources allocated to the thread instance. 

For version of VCL prior to VCL Version 6, an exception in the inherited constructor is indicated by ThreadID containing the value 0. This will result in a call to the RaiseLastOSError Windows API function to prevent access to the resources in the descendant class.

Data 

Options 

Loop 

Name 

Start 

Destroy

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.