Topic Path: Symbol Reference > Classes > TIdThread Class > TIdThread Methods > Destroy Destructor
TIdThread.Destroy Destructor

Frees the object instance.

destructor Destroy; override;

Destroy is the destructor for the object instance, and is responsible for freeing resources allocated to the thread instance as well as maintaining the global thread instance count. 

Destroy sets FreeOnTerminate to False to prevent multiple calls to the Destroy method from Terminate or TerminateAndWaitFor, and calls the Terminate method to ensure that thread execution has been halted. 

Destroy calls the inherited Destroy method to free the thread instance. Destroy also calls the Cleanup method to ensure that a resource allocated to the thread in BeforeRun, Run, or AfterRun are freed and released when Options includes the value itoReqCleanUp. 

Destroy frees the internal critical section for the thread instance. 

If the thread instance was successfully initialized in Create, the unit global thread counter is decremented to indicate that the thread is no longer active or viable.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.