MySQL 8.0.39
Source Code Documentation
|
Templated class that encapsulates an std::atomic
within a byte buffer that is padded to the processor cache-line size.
More...
#include <aligned_atomic.h>
Public Member Functions | |
Aligned_atomic () | |
Aligned_atomic (T value) | |
Aligned_atomic (Aligned_atomic< T > const &rhs)=delete | |
Aligned_atomic (Aligned_atomic< T > &&rhs) | |
virtual | ~Aligned_atomic () |
Aligned_atomic< T > & | operator= (Aligned_atomic< T > const &rhs)=delete |
Aligned_atomic< T > & | operator= (Aligned_atomic< T > &&rhs) |
Aligned_atomic< T > & | operator= (T rhs) |
operator T () const | |
Casting operator for directly accessing the value of the underlying std::atomic<T> . More... | |
bool | operator== (std::nullptr_t rhs) const |
Equality operator to determine if the underlying storage memory is initialized. More... | |
bool | operator!= (std::nullptr_t rhs) const |
Inequality operator to determine if the underlying storage memory is initialized. More... | |
bool | operator== (T rhs) const |
Equality operator for determining if the value stored in the underlying std::atomic equals the passed parameter. More... | |
bool | operator!= (T rhs) const |
Inequality operator for determining if the value stored in the underlying std::atomic differs from the passed parameter. More... | |
std::atomic< T > * | operator-> () |
const std::atomic< T > * | operator-> () const |
std::atomic< T > & | operator* () |
const std::atomic< T > & | operator* () const |
size_t | size () const |
size_t | allocated_size () const |
Private Attributes | |
size_t | m_storage_size {0} |
The size of the byte buffer. More... | |
void * | m_storage {nullptr} |
The byte buffer to use as underlying storage. More... | |
std::atomic< T > * | m_underlying {nullptr} |
The pointer to the underlying std::atomic<T> object. More... | |
Templated class that encapsulates an std::atomic
within a byte buffer that is padded to the processor cache-line size.
This class purpose is to help prevent false sharing between atomically accessed variables that are contiguous in memory. This is the normal case for arrays or class members declared next to each other.
If the intended usage is none of the above, std::atomic
class should be used since the below implementation allocates more memory than needed for storing the intended value (in order to implement the padding to the cache-line).
memory::Aligned_atomic< T >::Aligned_atomic |
memory::Aligned_atomic< T >::Aligned_atomic | ( | T | value | ) |
|
delete |
memory::Aligned_atomic< T >::Aligned_atomic | ( | Aligned_atomic< T > && | rhs | ) |
|
virtual |
size_t memory::Aligned_atomic< T >::allocated_size |
memory::Aligned_atomic< T >::operator T |
Casting operator for directly accessing the value of the underlying std::atomic<T>
.
T
stored in the underlying std::atomic
.. bool memory::Aligned_atomic< T >::operator!= | ( | std::nullptr_t | rhs | ) | const |
Inequality operator to determine if the underlying storage memory is initialized.
rhs | nullptr value |
bool memory::Aligned_atomic< T >::operator!= | ( | T | rhs | ) | const |
Inequality operator for determining if the value stored in the underlying std::atomic
differs from the passed parameter.
rhs | The value to compare with. |
std::atomic
, false otherwise. std::atomic< T > & memory::Aligned_atomic< T >::operator* |
const std::atomic< T > & memory::Aligned_atomic< T >::operator* |
std::atomic< T > * memory::Aligned_atomic< T >::operator-> |
const std::atomic< T > * memory::Aligned_atomic< T >::operator-> |
memory::Aligned_atomic< T > & memory::Aligned_atomic< T >::operator= | ( | Aligned_atomic< T > && | rhs | ) |
|
delete |
memory::Aligned_atomic< T > & memory::Aligned_atomic< T >::operator= | ( | T | rhs | ) |
bool memory::Aligned_atomic< T >::operator== | ( | std::nullptr_t | rhs | ) | const |
Equality operator to determine if the underlying storage memory is initialized.
rhs | nullptr value |
bool memory::Aligned_atomic< T >::operator== | ( | T | rhs | ) | const |
Equality operator for determining if the value stored in the underlying std::atomic
equals the passed parameter.
rhs | The value to compare with. |
std::atomic
, false otherwise. size_t memory::Aligned_atomic< T >::size |
|
private |
The byte buffer to use as underlying storage.
|
private |
The size of the byte buffer.
|
private |
The pointer to the underlying std::atomic<T>
object.