Indy 9
TIdThreadSafeInteger
Hierarchy, Properties, Methods, See Also, Unit: IdThreadSafe
Implements a thread-safe Integer data type.
TIdThreadSafeInteger = class(TIdThreadSafe)
Unit
IdThreadSafe
Description
TIdThreadSafeInteger is a TIdThreadSafe descendant that implements a thread-safe data type for storing an Integer value. TIdThreadSafeInteger does not rely on "compiler magic" to guarantee that integer operations are atomic, and is Operating System platform independent.

TIdThreadSafeInteger relies on the inherited TCriticalSection for resource protection in multi-threaded applications. TIdThreadSafeInteger implements the Value property for reading or writing the Integer value associated with the class instance with resource protection. TIdThreadSafeInteger also implements methods that protect write access to Value using Increment and Decrement.


TIdThreadSafeInteger.Value
TIdThreadSafeInteger, See Also
Reads or Writes the value for the thread-safe data type.
property Value: Integer;
Description
Value is an Integer property that represents the value for the thread-safe Integer data type. Read and write access to the content of Value uses the resource protection capabilities of the object instance to insure reliable access in multi-threaded applications.

TIdThreadSafeInteger.Decrement
TIdThreadSafeInteger, See Also
Decreases the value for the thread-safe data type.
function Decrement: Integer;
Description
Decrement is a procedure used to decrease by 1 the value of the thread-safe integer data type. Decrement calls Lock to enable the resource protection capabilities of the object instance prior to updating the associated value for the data type. Decrement calls Unlock to disable resource protection when the value is successfully updated, or an exception is raised.

Use Increment to increase by 1 the value of the thread-safe integer data type.


TIdThreadSafeInteger.Increment
TIdThreadSafeInteger, See Also
Increases the value for the thread-safe data type.
function Increment: Integer;
Description
Increment is a procedure used to increase by 1 the value of the thread-safe integer data type. Increment calls Lock to enable the resource protection capabilities of the object instance prior to updating the associated value for the data type. Increment calls Unlock to disable resource protection when the value is successfully updated, or an exception is raised.

Use Decrement to decrease by 1 the value of the thread-safe integer data type.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.