Simple class to hold a primitive value and perform atomic operations on it. More...
#include <juce_Atomic.h>


Public Types | |
| typedef AtomicBase< Type >::DiffType | DiffType |
| Resulting type when subtracting the underlying Type. More... | |
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... | |
| 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... | |
| Type | exchange (Type v) noexcept |
| Atomically sets the current value, returning the value that was replaced. More... | |
| Type | get () const noexcept |
| Atomically reads and returns the current value. More... | |
| Type | operator++ () noexcept |
| Atomically increments this value, returning the new value. More... | |
| Type | operator+= (DiffType amountToAdd) noexcept |
| Atomically adds a number to this value, returning the new value. More... | |
| Type | operator-- () noexcept |
| Atomically decrements this value, returning the new value. More... | |
| Type | operator-= (DiffType amountToSubtract) noexcept |
| Atomically subtracts a number from this value, returning the new 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... | |
Static Public Member Functions | |
| static void | memoryBarrier () noexcept |
| Implements a memory read/write barrier. More... | |
Public Attributes | |
| volatile Type | value |
| The raw value that this class operates on. More... | |
Protected Member Functions | |
| 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... | |
| Type | operator++ (int) |
| Type | operator-- (int) |
Static Protected Member Functions | |
| static Type | castFrom32Bit (int32 value) noexcept |
| static Type | castFrom64Bit (int64 value) noexcept |
| template<typename Dest , typename Source > | |
| static Dest | castTo (Source 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.
|
inlinenoexcept |
Creates a new value, initialised to zero.
|
inlineexplicitnoexcept |
Creates a new value, with a given initial value.
|
inlinenoexcept |
Copies another value (atomically).
|
inlinenoexcept |
Destructor.
|
inlinestaticprotectednoexceptinherited |
|
inlinestaticprotectednoexceptinherited |
|
inlinestaticprotectednoexceptinherited |
|
inlinestaticprotectednoexceptinherited |
|
inlinestaticprotectednoexceptinherited |
|
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:
Referenced by juce::ThreadLocalValue< Type >::get().
|
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:
|
inlinenoexcept |
Atomically sets the current value, returning the value that was replaced.
|
inlinenoexcept |
Atomically reads and returns the current value.
Referenced by juce::ThreadLocalValue< Type >::get(), and juce::RenderingHelpers::GlyphCache< CachedGlyphType, RenderTargetType >::getGlyphForReuse().
|
inlinestaticnoexcept |
Implements a memory read/write barrier.
|
inlineprotectednoexceptinherited |
This templated negate function will negate pointers as well as integers.
|
inlineprotectednoexceptinherited |
This templated negate function will negate pointers as well as integers.
|
inlinenoexcept |
Atomically increments this value, returning the new value.
|
protectedinherited |
|
inlinenoexcept |
Atomically adds a number to this value, returning the new value.
|
inlinenoexcept |
Atomically decrements this value, returning the new value.
|
protectedinherited |
|
inlinenoexcept |
Atomically subtracts a number from this value, returning the new value.
|
inlinenoexcept |
Copies another value into this one (atomically).
|
inlinenoexcept |
Copies another value into this one (atomically).
|
inlinenoexcept |
Atomically sets the current value.
|
inherited |
The raw value that this class operates on.
This is exposed publicly in case you need to manipulate it directly for performance reasons.
Referenced by juce::LeakedObjectDetector< OwnerClass >::LeakCounter::~LeakCounter().