Topic Path: Pending > TIdAntiFreeze.ShouldUse

Indicates that TIdAntiFreeze is in use, and processor cycles should be yielded to the main thread.

Boolean - True when the client is in the main thread and an active TIdAntiFreezeBase descendant is in use.

ShouldUse is an overridden Boolean class function that indicates when TIdAntiFreeze is in use in an application, and that the component should yield to the main thread of execution. 

ShouldUse accesses the GAntiFreeze variable to determine if a TIdAntiFreeze instance has been assigned and activated. 

ShouldUse will return True when all of the following conditions are met: 


Item Condition 

------------ -------------------------------


GAntiFreeze Not nil 
GAntiFreeze Active property value is True 
InMainThread Return value is True 


ShouldUse is called from TIdAntiFreezeBase.Sleep, as well as in TIdSocketHandle and TIdIOHandlerStack methods that implement connection timeout features. 

ShouldUse is overridden in TIdAntiFreezeBase because it uses the InMainThread function, which is not presently available in .Net. ShouldUse will most likely be removed from TIdAntiFreezeBase when a suitable .Net implementation for InMainThread is avavilable.

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