MySQL 8.0.40
Source Code Documentation
|
Lock-free pool which consists of POOL_SIZE Lock_free_type elements. More...
#include <lock_free_pool.h>
Public Types | |
using | Type = typename Lock_free_type< T, ALIGNMENT, TypeSelector >::Type |
Public Member Functions | |
Lock_free_pool () | |
Default constructor. More... | |
Lock_free_pool (Lock_free_pool::Type default_value) | |
Constructor. More... | |
Lock_free_pool (const Lock_free_pool &)=delete | |
Copy-constructor and copy-assignment operator are disabled. More... | |
Lock_free_pool & | operator= (const Lock_free_pool &)=delete |
Lock_free_pool (Lock_free_pool &&)=delete | |
Ditto for move-constructor and move-assignment operator. More... | |
Lock_free_pool & | operator= (Lock_free_pool &&)=delete |
void | store (size_t idx, Lock_free_pool::Type value, std::memory_order order=std::memory_order_seq_cst) |
Atomically replaces current value in an array at given index. More... | |
Lock_free_pool::Type | load (size_t idx, std::memory_order order=std::memory_order_seq_cst) const |
Atomically loads and returns the current value from an array at given index. More... | |
bool | compare_exchange_strong (size_t idx, Lock_free_pool::Type &expected, Lock_free_pool::Type desired, std::memory_order order=std::memory_order_seq_cst) |
Atomically compares the object representation of an array element at given index with the expected, and if those are bitwise-equal, replaces the former with desired. More... | |
constexpr size_t | size () const |
Returns the number of elements this pool contains. More... | |
Private Attributes | |
std::array< Lock_free_type< T, ALIGNMENT, TypeSelector >, POOL_SIZE > | m_lock_free |
Lock-free pool which consists of POOL_SIZE Lock_free_type elements.
It has all the guarantees and properties of Lock_free_type and its consisting pieces so for more details please consult the documentation of those. E.g. user code can opt-in for different alignment-requirements and/or lock-free type selection algorithms. This type is envisioned to be used as a building block for higher-abstraction (lock-free) ADTs.
using temptable::Lock_free_pool< T, POOL_SIZE, ALIGNMENT, TypeSelector >::Type = typename Lock_free_type<T, ALIGNMENT, TypeSelector>::Type |
|
inline |
Default constructor.
Uses value-initialization to initialize underlying T's.
|
inline |
Constructor.
Uses explicit value to initialize underlying T's.
|
delete |
Copy-constructor and copy-assignment operator are disabled.
|
delete |
Ditto for move-constructor and move-assignment operator.
|
inline |
Atomically compares the object representation of an array element at given index with the expected, and if those are bitwise-equal, replaces the former with desired.
[in] idx Index of an element whose value is to be compared against. [in] expected Value expected to be found in the atomic object. Gets stored with the actual value of *this if the comparison fails. [in] desired Value to store in the atomic object if it is as expected. [in] order Memory order constraints to enforce.
|
inline |
Atomically loads and returns the current value from an array at given index.
[in] idx Index of an element whose value is to be returned. [in] order Memory order constraints to enforce.
|
delete |
|
delete |
|
inlineconstexpr |
Returns the number of elements this pool contains.
|
inline |
Atomically replaces current value in an array at given index.
[in] idx Index of an element whose value is to be replaced. [in] value Value to store into the atomic variable. [in] order Memory order constraints to enforce.
|
private |