SYS_AtomicInt32 Class Reference

#include <SYS_AtomicInt.h>

List of all members.

Public Member Functions

 SYS_AtomicInt32 (int32 value=0)
int32 exchange (int32 val)
int32 exchangeAdd (int32 val)
int32 add (int32 val)
 Atomically adds val to myValue, returning the new value of myValue.
void maximum (int32 val)
 Atomically set myValue to the maximum of val and myValue.
int32 compare_swap (int32 expected, int32 desired)
void store (int32 val, SYS_MemoryOrder order=SYS_MEMORY_ORDER_SEQ_CST)
int32 load (SYS_MemoryOrder order=SYS_MEMORY_ORDER_SEQ_CST) const
 operator int32 () const
 Atomically retrieve value. Same as calling load().


Detailed Description

Definition at line 25 of file SYS_AtomicInt.h.


Constructor & Destructor Documentation

SYS_AtomicInt32::SYS_AtomicInt32 ( int32  value = 0  )  [inline, explicit]

Definition at line 28 of file SYS_AtomicInt.h.


Member Function Documentation

SYS_ATOMIC_INLINE int32 SYS_AtomicInt32::add ( int32  val  )  [inline]

Atomically adds val to myValue, returning the new value of myValue.

Definition at line 42 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE int32 SYS_AtomicInt32::compare_swap ( int32  expected,
int32  desired 
) [inline]

Atomically compares (myValue == expected), and if true, replaces myValue with desired. Returns prior myValue.

Definition at line 59 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE int32 SYS_AtomicInt32::exchange ( int32  val  )  [inline]

Note that to use any of these three methods you must include SYS_AtomicIntImpl. Do *not* include that file in a .h file as it brings in windows.h! Atomically assigns val to myValue, returning the prior value of myValue.

Atomically assigns val to myValue, returning the prior value of myValue.

Definition at line 27 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE int32 SYS_AtomicInt32::exchangeAdd ( int32  val  )  [inline]

Atomically adds val to myValue, returning the prior value of myValue.

Definition at line 35 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE int32 SYS_AtomicInt32::load ( SYS_MemoryOrder  order = SYS_MEMORY_ORDER_SEQ_CST  )  const [inline]

Precondition:
The supplied order must be one of [RELAXED, CONSUME, ACQUIRE, SEQ_CST].
Method intentionally not marked as volatile as this would cause &myValue to evaluate to a pointer to a volatile myValue and that has implications on MSVC2005+ beyond the C++ spec.

This shouldn't be a problem unless somebody needs a volatile instance of SYS_AtomicInt32.

Definition at line 83 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE void SYS_AtomicInt32::maximum ( int32  val  )  [inline]

Atomically set myValue to the maximum of val and myValue.

Definition at line 48 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE SYS_AtomicInt32::operator int32 (  )  const

Atomically retrieve value. Same as calling load().

Definition at line 89 of file SYS_AtomicIntImpl.h.

SYS_ATOMIC_INLINE void SYS_AtomicInt32::store ( int32  val,
SYS_MemoryOrder  order = SYS_MEMORY_ORDER_SEQ_CST 
) [inline]

Precondition:
The supplied order must be one of [RELAXED, RELEASE, SEQ_CST].
Method intentionally not marked as volatile as this would cause &myValue to evaluate to a pointer to a volatile myValue and that has implications on MSVC2005+ beyond the C++ spec.

This shouldn't be a problem unless somebody needs a volatile instance of SYS_AtomicInt32.

Definition at line 71 of file SYS_AtomicIntImpl.h.


The documentation for this class was generated from the following files:

Generated on Mon Jan 28 00:30:04 2013 for HDK by  doxygen 1.5.9