JUCE
|
Simple class to hold a primitive value and perform atomic operations on it. More...
Public Types | |
typedef AtomicBase< Type >::DiffType | DiffType |
Resulting type when subtracting the underlying Type. More... | |
![]() | |
typedef AtomicHelpers::DiffTypeHelper< Type >::Type | DiffType |
Public Member Functions | |
Atomic () noexcept | |
Creates a new value, initialised to zero. More... | |
Atomic (const Type initialValue) noexcept | |
Creates a new value, with a given initial value. More... | |
Atomic (const Atomic &other) noexcept | |
Copies another value (atomically). More... | |
~Atomic () noexcept | |
Destructor. More... | |
Type | get () const noexcept |
Atomically reads and returns the current value. More... | |
Atomic & | operator= (const Atomic &other) noexcept |
Copies another value into this one (atomically). More... | |
Atomic & | operator= (const Type newValue) noexcept |
Copies another value into this one (atomically). More... | |
void | set (Type newValue) noexcept |
Atomically sets the current value. More... | |
Type | exchange (Type v) noexcept |
Atomically sets the current value, returning the value that was replaced. More... | |
Type | operator+= (DiffType amountToAdd) noexcept |
Atomically adds a number to this value, returning the new value. More... | |
Type | operator-= (DiffType amountToSubtract) noexcept |
Atomically subtracts a number from this value, returning the new value. More... | |
Type | operator++ () noexcept |
Atomically increments this value, returning the new value. More... | |
Type | operator-- () noexcept |
Atomically decrements this value, returning the new value. More... | |
bool | compareAndSetBool (Type newValue, Type valueToCompare) noexcept |
Atomically compares this value with a target value, and if it is equal, sets this to be equal to a new value. More... | |
Type | compareAndSetValue (Type newValue, Type valueToCompare) noexcept |
Atomically compares this value with a target value, and if it is equal, sets this to be equal to a new value. More... | |
![]() | |
AtomicBase () noexcept | |
AtomicBase (const Type v) noexcept | |
AtomicBase (const AtomicBase &other) noexcept | |
Type | get () const noexcept |
AtomicBase & | operator= (const AtomicBase< Type > &other) noexcept |
AtomicBase & | operator= (const Type newValue) noexcept |
void | set (Type newValue) noexcept |
Type | exchange (Type) noexcept |
bool | compareAndSetBool (Type, Type) noexcept |
Type | compareAndSetValue (Type, Type) noexcept |
Static Public Member Functions | |
static void | memoryBarrier () noexcept |
Implements a memory read/write barrier. More... | |
![]() | |
static void | memoryBarrier () noexcept |
Additional Inherited Members | |
![]() | |
volatile Type | value |
The raw value that this class operates on. More... | |
![]() | |
Type | operator++ (int) |
Type | operator-- (int) |
template<typename ValueType > | |
ValueType | negateValue (ValueType n) noexcept |
This templated negate function will negate pointers as well as integers. More... | |
template<typename PointerType > | |
PointerType * | negateValue (PointerType *n) noexcept |
This templated negate function will negate pointers as well as integers. More... | |
![]() | |
template<typename Dest , typename Source > | |
static Dest | castTo (Source value) noexcept |
static Type | castFrom32Bit (int32 value) noexcept |
static Type | castFrom64Bit (int64 value) noexcept |
static int32 | castTo32Bit (Type value) noexcept |
static int64 | castTo64Bit (Type value) noexcept |
Simple class to hold a primitive value and perform atomic operations on it.
The type used must be a 32 or 64 bit primitive, like an int, pointer, etc. There are methods to perform most of the basic atomic operations.
typedef AtomicBase<Type>::DiffType juce::Atomic< Type >::DiffType |
Resulting type when subtracting the underlying Type.
|
noexcept |
Creates a new value, initialised to zero.
|
explicitnoexcept |
Creates a new value, with a given initial value.
|
noexcept |
Copies another value (atomically).
|
noexcept |
Destructor.
|
noexcept |
Atomically reads and returns the current value.
Referenced by juce::ThreadLocalValue< Type >::get(), juce::ThreadLocalValue< Type >::releaseCurrentThreadStorage(), and juce::ThreadLocalValue< Type >::~ThreadLocalValue().
|
noexcept |
Copies another value into this one (atomically).
|
noexcept |
Copies another value into this one (atomically).
|
noexcept |
Atomically sets the current value.
|
noexcept |
Atomically sets the current value, returning the value that was replaced.
|
noexcept |
Atomically adds a number to this value, returning the new value.
|
noexcept |
Atomically subtracts a number from this value, returning the new value.
|
noexcept |
Atomically increments this value, returning the new value.
|
noexcept |
Atomically decrements this value, returning the new value.
|
noexcept |
Atomically compares this value with a target value, and if it is equal, sets this to be equal to a new value.
This operation is the atomic equivalent of doing this:
Referenced by juce::ThreadLocalValue< Type >::get().
|
noexcept |
Atomically compares this value with a target value, and if it is equal, sets this to be equal to a new value.
This operation is the atomic equivalent of doing this:
|
staticnoexcept |
Implements a memory read/write barrier.