OpenShot Library | OpenShotAudio 0.2.2
|
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. More... | |
Atomic (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... | |
void | set (Type newValue) noexcept |
Atomically sets the current value. More... | |
Type | exchange (Type newValue) noexcept |
Atomically sets the current value, returning the value that was replaced. 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... | |
Atomic< Type > & | operator= (const Atomic &other) noexcept |
Copies another value into this one (atomically). More... | |
Atomic< Type > & | operator= (Type newValue) noexcept |
Copies another value into this one (atomically). 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... | |
void | memoryBarrier () noexcept |
Implements a memory read/write barrier. More... | |
Public Attributes | |
std::atomic< Type > | value |
The std::atomic object that this class operates on. More... | |
A simple wrapper around std::atomic.
Definition at line 45 of file juce_Atomic.h.
using juce::Atomic< Type >::DiffType = typename AtomicHelpers::DiffTypeHelper<Type>::Type |
Definition at line 47 of file juce_Atomic.h.
|
inlinenoexcept |
Creates a new value, initialised to zero.
Definition at line 50 of file juce_Atomic.h.
|
inlinenoexcept |
Creates a new value, with a given initial value.
Definition at line 53 of file juce_Atomic.h.
|
inlinenoexcept |
Copies another value (atomically).
Definition at line 56 of file juce_Atomic.h.
|
inlinenoexcept |
Destructor.
Definition at line 59 of file juce_Atomic.h.
|
inlinenoexcept |
Atomically reads and returns the current value.
Definition at line 68 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
Referenced by juce::MessageManager::currentThreadHasLockedMessageManager(), juce::ThreadLocalValue< Type >::get(), juce::AbstractFifo::getNumReady(), juce::Thread::getThreadId(), juce::Thread::isThreadRunning(), juce::ThreadLocalValue< Type >::releaseCurrentThreadStorage(), juce::Thread::setPriority(), juce::Thread::startThread(), juce::Thread::threadShouldExit(), and juce::ThreadLocalValue< Type >::~ThreadLocalValue().
|
inlinenoexcept |
Atomically sets the current value.
Definition at line 71 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically sets the current value, returning the value that was replaced.
Definition at line 74 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
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).
Definition at line 100 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
Referenced by juce::ThreadLocalValue< Type >::get(), and juce::AsyncUpdater::AsyncUpdaterMessage::messageCallback().
|
inlinenoexcept |
Copies another value into this one (atomically).
Definition at line 106 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Copies another value into this one (atomically).
Definition at line 113 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically adds a number to this value, returning the new value.
Definition at line 120 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically subtracts a number from this value, returning the new value.
Definition at line 123 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically increments this value, returning the new value.
Definition at line 126 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Atomically decrements this value, returning the new value.
Definition at line 129 of file juce_Atomic.h.
References juce::Atomic< Type >::value.
|
inlinenoexcept |
Implements a memory read/write barrier.
Internally this calls std::atomic_thread_fence with memory_order_seq_cst (the strictest std::memory_order).
Definition at line 136 of file juce_Atomic.h.
std::atomic<Type> juce::Atomic< Type >::value |
The std::atomic object that this class operates on.
Definition at line 139 of file juce_Atomic.h.
Referenced by 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=(), and juce::Atomic< Type >::set().