TC::Interlocked Namespace Reference
[Base Classes and Functions]

Methods for interlocked modifying of integer values. More...


Typedefs

typedef long Type
 Data type for interlockee operations.

Functions

Type Increment (Type &target)
 The function increments (increases by one) the value of the specified variable.
Type Decrement (Type &target)
 The function decrements (decreases by one) the value of the specified variable.
Type Exchange (Type &target, sint32 new_value)
 The function atomically exchanges a pair of values.
Type Add (Type &target, sint32 value_to_add)
 The function performs an atomic addition of an increment value to an addend variable.


Detailed Description

Methods for interlocked modifying of integer values.

Author:
Thomas Goessler


Typedef Documentation

typedef long TC::Interlocked::Type

Data type for interlockee operations.

Definition at line 61 of file TCInterlocked.h.


Function Documentation

Type TC::Interlocked::Increment ( Type &  target  ) 

The function increments (increases by one) the value of the specified variable.

The function prevents more than one thread from using the same variable simultaneously.

Parameters:
target [in, out] reference of the variable to be incremented.
Returns:
The return value is the resulting incremented value.

Referenced by TC::Impl::SharedPtrCountBase::AddReference(), and TC::Impl::SharedPtrCountBase::AddWeakReference().

Here is the caller graph for this function:

Type TC::Interlocked::Decrement ( Type &  target  ) 

The function decrements (decreases by one) the value of the specified variable.

The function prevents more than one thread from using the same variable simultaneously.

Parameters:
target [in, out] reference of the variable to be decremented.
Returns:
The return value is the resulting decremented value.

Referenced by TC::Impl::SharedPtrCountBase::ReleaseReference(), and TC::Impl::SharedPtrCountBase::ReleaseWeakReference().

Here is the caller graph for this function:

Type TC::Interlocked::Exchange ( Type &  target,
sint32  new_value 
)

The function atomically exchanges a pair of values.

The function prevents more than one thread from using the same variable simultaneously.

Parameters:
target [in, out] reference to the value to be exchanged. The function sets this variable to new_value, and returns its prior value.
new_value [in] Value to be exchanged with the value pointed to by Target.
Returns:
The return value is the prior target value value.

Type TC::Interlocked::Add ( Type &  target,
sint32  value_to_add 
)

The function performs an atomic addition of an increment value to an addend variable.

The function prevents more than one thread from using the same variable simultaneously.

Parameters:
target [in, out] Pointer to the value that is to have Value added to it.
value_to_add [in] Value to be added to the variable pointed to by the Addend parameter.
Returns:
The return value is the initial value of the variable pointed to by the Addend parameter.


Copyright (c) Thomas Goessler 2003 - 2008