18#include <boost/static_assert.hpp>
20#include "mongo/base/disallow_copying.h"
21#include "mongo/platform/atomic_intrinsics.h"
22#include "mongo/platform/compiler.h"
46template <
typename _WordType>
48 MONGO_DISALLOW_COPYING(AtomicWord);
159#define _ATOMIC_WORD_DECLARE(NAME, WTYPE) \
160 typedef class AtomicWord<WTYPE> NAME; \
162 BOOST_STATIC_ASSERT(sizeof(NAME) == sizeof(WTYPE)); \
165_ATOMIC_WORD_DECLARE(AtomicUInt32,
unsigned);
166_ATOMIC_WORD_DECLARE(AtomicUInt64,
unsigned long long);
167_ATOMIC_WORD_DECLARE(AtomicInt32,
int);
168_ATOMIC_WORD_DECLARE(AtomicInt64,
long long);
169#undef _ATOMIC_WORD_DECLARE
Instantiation of AtomicIntrinsics<> for all word types T.
Definition atomic_intrinsics_gcc_atomic.h:29
WordType load() const
Gets the current value of this AtomicWord.
Definition atomic_word_intrinsics.h:66
WordType swap(WordType newValue)
Atomically swaps the current value of this with "newValue".
Definition atomic_word_intrinsics.h:95
WordType fetchAndAdd(WordType increment)
Get the current value of this, add "increment" and store it, atomically.
Definition atomic_word_intrinsics.h:118
WordType compareAndSwap(WordType expected, WordType newValue)
Atomic compare and swap.
Definition atomic_word_intrinsics.h:107
void store(WordType newValue)
Sets the value of this AtomicWord to "newValue".
Definition atomic_word_intrinsics.h:84
WordType subtractAndFetch(WordType decrement)
Get the current value of this, subtract "decrement" and store it, atomically.
Definition atomic_word_intrinsics.h:151
AtomicWord(WordType value=WordType(0))
Construct a new word with the given initial value.
Definition atomic_word_intrinsics.h:59
WordType fetchAndSubtract(WordType decrement)
Get the current value of this, subtract "decrement" and store it, atomically.
Definition atomic_word_intrinsics.h:129
WordType addAndFetch(WordType increment)
Get the current value of this, add "increment" and store it, atomically.
Definition atomic_word_intrinsics.h:140
WordType loadRelaxed() const
Gets the current value of this AtomicWord.
Definition atomic_word_intrinsics.h:75
_WordType WordType
Underlying value type.
Definition atomic_word_intrinsics.h:54
Utility functions for parsing numbers from strings.
Definition compare_numbers.h:20