Internet Direct (Indy) Version 9.0.2 Beta
TIdThreadMgrPool.GetThread
Requests a new thread for the thread manager.

function GetThread: TIdThread; override;
Returns
TIdThread - The new thread instance.

Description
GetThread is an implementation of the inherited abstract TIdThread function that requests a new thread for the thread manager. GetThread tries to satisfy new thread requests by retrieving an existing thread instance from ThreadPool. <-- While GetThread searches for a pooled thread, it also frees and deletes any Terminated threads. The pooled thread instance is removed from ThreadPool. -->

If there are no existing threads in ThreadPool, GetThread can create a new thread instance using CreateNewThread. The new thread instance will have the StopMode value smSuspend. The thread instance will be added to ActiveThreads and returned as the result of GetThread.

GetThread locks the ThreadPool while extracting a thread for reuse.

A thread instance can be freed using ReleaseThread. A list of threads can be terminated and freed using TerminateThreads.