Topic Path: Symbol Reference > Classes > TIdStack Class > TIdStack Methods > IncUsage Method
ContentsIndexHome
PreviousUpNext
TIdStack.IncUsage Method

Maintains the internal usage counter for the global protocol stack in the Indy library.

class procedure IncUsage;

IncUsage is a class procedure used to maintain a counter for the number of times the stack instance has be accessed for Indy components. 

IncUsage can raise an EAssertionFailed exception if the critical section used to protect access to resources for the protocol stack in GStackCriticalSection has not been assigned a valid value. 

IncUsage calls the Acquire method for the critical section and attempts to increment the value in the GInstanceCount variable. When GInstanceCount contains the value 1 (one), the global stack instance in GStack is Created. 

The Release method for the critical section is called when the operation is completed, or an exception occurs in accessing the resources protected by the critical section. 

DecUsage is used to decrement the global usage counter. 

Please note that applications do not normally call the IncUsage and DecUsage methods for the global stack instance; these method are called when TIdComponent or TIdBuffer instances are created, or when design-time property editors are created in the .Net environment.

Exceptions 
Description 
EAssertionFailed 
Raised when the critical section used to protect access to resources for the protocol stack in GStackCriticalSection has not been assigned. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.