ACE
6.3.3
|
Transparently parameterizes synchronization into basic arithmetic operations. More...
#include <Atomic_Op_T.h>
Public Types | |
typedef ACE_Type_Traits< TYPE >::parameter_type | arg_type |
Public Member Functions | |
ACE_Atomic_Op_Ex (ACE_LOCK &mtx) | |
Initialize value_ to 0. More... | |
ACE_Atomic_Op_Ex (ACE_LOCK &mtx, arg_type c) | |
Initialize value_ to c. More... | |
TYPE | operator++ (void) |
Atomically pre-increment value_ . More... | |
TYPE | operator++ (int) |
Atomically post-increment value_ . More... | |
TYPE | operator+= (arg_type rhs) |
Atomically increment value_ by rhs. More... | |
TYPE | operator-- (void) |
Atomically pre-decrement value_ . More... | |
TYPE | operator-- (int) |
Atomically post-decrement value_ . More... | |
TYPE | operator-= (arg_type rhs) |
Atomically decrement value_ by rhs. More... | |
bool | operator== (arg_type rhs) const |
Atomically compare value_ with rhs. More... | |
bool | operator!= (arg_type rhs) const |
Atomically compare value_ with rhs. More... | |
bool | operator>= (arg_type rhs) const |
Atomically check if value_ greater than or equal to rhs. More... | |
bool | operator> (arg_type rhs) const |
Atomically check if value_ greater than rhs. More... | |
bool | operator<= (arg_type rhs) const |
Atomically check if value_ less than or equal to rhs. More... | |
bool | operator< (arg_type rhs) const |
Atomically check if value_ less than rhs. More... | |
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > & | operator= (arg_type rhs) |
Atomically assign rhs to value_ . More... | |
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > & | operator= (ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > const &rhs) |
Atomically assign <rhs> to value_ . More... | |
TYPE | exchange (TYPE newval) |
Exchange value with newval. More... | |
TYPE | value (void) const |
Explicitly return value_ . More... | |
void | dump (void) const |
Dump the state of an object. More... | |
ACE_Atomic_Op_Ex (ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > const &) | |
Manage copying... More... | |
ACE_LOCK & | mutex (void) |
TYPE & | value_i (void) |
Private Attributes | |
ACE_LOCK & | mutex_ |
Type of synchronization mechanism. More... | |
TYPE | value_ |
Current object decorated by the atomic op. More... | |
Transparently parameterizes synchronization into basic arithmetic operations.
This class is described in an article in the July/August 1994 issue of the C++ Report magazine. It implements a templatized version of the Decorator pattern from the GoF book.
ACE_Atomic_Op_Ex objects must be constructed with a reference to an existing lock. A single lock can be shared between multiple ACE_Atomic_Op_Ex objects. If you do not require this ability consider using the ACE_Atomic_Op class instead, which may be able to take advantage of platform-specific optimisations to provide atomic operations without requiring a lock.
typedef ACE_Type_Traits<TYPE>::parameter_type ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::arg_type |
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::ACE_Atomic_Op_Ex | ( | ACE_LOCK & | mtx | ) |
Initialize value_
to 0.
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::ACE_Atomic_Op_Ex | ( | ACE_LOCK & | mtx, |
arg_type | c | ||
) |
Initialize value_
to c.
|
inline |
Manage copying...
void ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::dump | ( | void | ) | const |
Dump the state of an object.
|
inline |
Exchange value with newval.
ACE_LOCK & ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::mutex | ( | void | ) |
Returns a reference to the underlying ACE_LOCK. This makes it possible to acquire the lock explicitly, which can be useful in some cases if you instantiate the ACE_Atomic_Op_Ex with an ACE_Recursive_Mutex or ACE_Process_Mutex.
|
inline |
Atomically compare value_
with rhs.
|
inline |
Atomically pre-increment value_
.
|
inline |
Atomically post-increment value_
.
|
inline |
Atomically increment value_
by rhs.
|
inline |
Atomically pre-decrement value_
.
|
inline |
Atomically post-decrement value_
.
|
inline |
Atomically decrement value_
by rhs.
|
inline |
Atomically check if value_
less than rhs.
|
inline |
Atomically check if value_
less than or equal to rhs.
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>& ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator= | ( | arg_type | rhs | ) |
Atomically assign rhs to value_
.
|
inline |
Atomically assign <rhs> to value_
.
|
inline |
Atomically compare value_
with rhs.
|
inline |
Atomically check if value_
greater than rhs.
|
inline |
Atomically check if value_
greater than or equal to rhs.
|
inline |
Explicitly return value_
.
|
inline |
Explicitly return value_
(by reference). This gives the user full, unrestricted access to the underlying value. This method will usually be used in conjunction with explicit access to the lock. Use with care ;-)
|
private |
Type of synchronization mechanism.
|
private |
Current object decorated by the atomic op.