Topic Path: Symbol Reference > Classes > TIdSchedulerOfThreadPool Class > TIdSchedulerOfThreadPool Methods > AcquireYarn Method
ContentsIndexHome
PreviousUpNext
TIdSchedulerOfThreadPool.AcquireYarn Method

Gets a valid yarn for the scheduler.

function AcquireYarn: TIdYarn; override;

TIdYarn - Thread-based or fiber-based task for the scheduler.

AcquireYarn is an overridden TIdYarn function that implements the interface used to access a TIdYarn instance for the scheduler. AcquireYarn implements the abstract virtual method from the ancestor class that specializes in creating threads for the scheduler. 

AcquireYarn use an existing thread from the thread pool for the scheduler. If no threads are available in the thread pool, a new TIdThreadWithTask instance is created by calling the NewThread method. 

AcquireYarn creates a new yarn for the thread-based scheduler by calling NewYarn using the thread for the executable task for the client connection. The IdYarn instance is added to the ActiveYarns property for subsequent execution. 

Use StartYarn to begin executing the thread or fiber for the client connection task. 

Use TerminateYarn to stop executing the thread or fiber for the client connection task. 

Use TerminateAllYarns to force termination of all TIdYarn instances in ActiveYarns

Use ReleaseYarn to free a yarn in ActiveYarns that has already been terminated.

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