A simple wrapper around std::atomic. More...
#include <juce_Atomic.h>


Public Types | |
| using | DiffType = typename AtomicHelpers::DiffTypeHelper< Type >::Type |
Public Member Functions | |
| Atomic () noexcept | |
| Creates a new value, initialised to zero. | |
| Atomic (const Atomic &other) noexcept | |
| Copies another value (atomically). | |
| Atomic (Type initialValue) noexcept | |
| Creates a new value, with a given initial value. | |
| ~Atomic () noexcept | |
| Destructor. | |
| 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. | |
| Type | exchange (Type newValue) noexcept |
| Atomically sets the current value, returning the value that was replaced. | |
| Type | get () const noexcept |
| Atomically reads and returns the current value. | |
| void | memoryBarrier () noexcept |
| Implements a memory read/write barrier. | |
| Type | operator++ () noexcept |
| Atomically increments this value, returning the new value. | |
| Type | operator+= (DiffType amountToAdd) noexcept |
| Atomically adds a number to this value, returning the new value. | |
| Type | operator-- () noexcept |
| Atomically decrements this value, returning the new value. | |
| Type | operator-= (DiffType amountToSubtract) noexcept |
| Atomically subtracts a number from this value, returning the new value. | |
| Atomic< Type > & | operator= (const Atomic &other) noexcept |
| Copies another value into this one (atomically). | |
| Atomic< Type > & | operator= (Type newValue) noexcept |
| Copies another value into this one (atomically). | |
| void | set (Type newValue) noexcept |
| Atomically sets the current value. | |
Public Attributes | |
| std::atomic< Type > | value |
| The std::atomic object that this class operates on. | |
A simple wrapper around std::atomic.
@tags{Core}
| using juce::Atomic< Type >::DiffType = typename AtomicHelpers::DiffTypeHelper<Type>::Type |
|
inlinenoexcept |
Creates a new value, initialised to zero.
|
inlinenoexcept |
Creates a new value, with a given initial value.
|
inlinenoexcept |
Copies another value (atomically).
|
inlinenoexcept |
Destructor.
|
inlinenoexcept |
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:
Internally, this method calls std::atomic::compare_exchange_strong with memory_order_seq_cst (the strictest std::memory_order).
References juce::Atomic< Type >::value.
Referenced by juce::ThreadLocalValue< Type >::get().
|
inlinenoexcept |
Atomically sets the current value, returning the value that was replaced.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically reads and returns the current value.
References juce::Atomic< Type >::value.
Referenced by juce::ThreadLocalValue< Type >::get().
|
inlinenoexcept |
Implements a memory read/write barrier.
Internally this calls std::atomic_thread_fence with memory_order_seq_cst (the strictest std::memory_order).
|
inlinenoexcept |
Atomically increments this value, returning the new value.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically adds a number to this value, returning the new value.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically decrements this value, returning the new value.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically subtracts a number from this value, returning the new value.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Copies another value into this one (atomically).
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Copies another value into this one (atomically).
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically sets the current value.
References juce::Atomic< Type >::value.
| std::atomic<Type> juce::Atomic< Type >::value |
The std::atomic object that this class operates on.
Referenced by juce::LeakedObjectDetector< OwnerClass >::LeakCounter::~LeakCounter(), juce::Atomic< Type >::compareAndSetBool(), juce::Atomic< Type >::exchange(), juce::Atomic< Type >::get(), juce::Atomic< Type >::operator++(), juce::Atomic< Type >::operator+=(), juce::Atomic< Type >::operator--(), juce::Atomic< Type >::operator-=(), juce::Atomic< Type >::operator=(), juce::Atomic< Type >::operator=(), and juce::Atomic< Type >::set().