POSIX Shared Memory Data Structures 1.0
High-performance lock-free data structures for inter-process communication
|
Shared memory atomic value with auto-discovery. More...
#include <shm_atomic.h>
Public Types | |
using | value_type = T |
Public Member Functions | |
template<typename ShmType > | |
shm_atomic (ShmType &shm, std::string_view name, T initial_value=T{}) | |
Create or open a shared atomic value. | |
bool | is_lock_free () const noexcept |
void | store (T value, std::memory_order order=std::memory_order_seq_cst) noexcept |
T | load (std::memory_order order=std::memory_order_seq_cst) const noexcept |
T | exchange (T value, std::memory_order order=std::memory_order_seq_cst) noexcept |
bool | compare_exchange_weak (T &expected, T desired, std::memory_order success=std::memory_order_seq_cst, std::memory_order failure=std::memory_order_seq_cst) noexcept |
bool | compare_exchange_strong (T &expected, T desired, std::memory_order success=std::memory_order_seq_cst, std::memory_order failure=std::memory_order_seq_cst) noexcept |
template<typename U = T> requires std::is_integral_v<U> || std::is_floating_point_v<U> | |
T | fetch_add (T arg, std::memory_order order=std::memory_order_seq_cst) noexcept |
template<typename U = T> requires std::is_integral_v<U> || std::is_floating_point_v<U> | |
T | fetch_sub (T arg, std::memory_order order=std::memory_order_seq_cst) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | fetch_and (T arg, std::memory_order order=std::memory_order_seq_cst) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | fetch_or (T arg, std::memory_order order=std::memory_order_seq_cst) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | fetch_xor (T arg, std::memory_order order=std::memory_order_seq_cst) noexcept |
T | operator= (T value) noexcept |
operator T () const noexcept | |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator++ () noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator++ (int) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator-- () noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator-- (int) noexcept |
template<typename U = T> requires std::is_integral_v<U> || std::is_floating_point_v<U> | |
T | operator+= (T arg) noexcept |
template<typename U = T> requires std::is_integral_v<U> || std::is_floating_point_v<U> | |
T | operator-= (T arg) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator&= (T arg) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator|= (T arg) noexcept |
template<typename U = T> requires std::is_integral_v<U> | |
T | operator^= (T arg) noexcept |
std::string_view | name () const noexcept |
void | wait (T old, std::memory_order order=std::memory_order_seq_cst) const noexcept |
void | notify_one () noexcept |
void | notify_all () noexcept |
Static Public Attributes | |
static constexpr bool | is_always_lock_free = std::atomic<T>::is_always_lock_free |
Shared memory atomic value with auto-discovery.
Provides a named atomic value in shared memory that can be discovered by other processes. Fully compatible with std::atomic interface.
T | Type of the atomic value (must be trivially copyable and lock-free) |
TableType | Type of metadata table (default: shm_table) |
Definition at line 19 of file shm_atomic.h.
using shm_atomic< T, TableType >::value_type = T |
Definition at line 32 of file shm_atomic.h.
|
inline |
Create or open a shared atomic value.
Definition at line 38 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 102 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 96 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 92 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 111 of file shm_atomic.h.
Referenced by shm_atomic< T, TableType >::operator++(), shm_atomic< T, TableType >::operator++(), and shm_atomic< T, TableType >::operator+=().
|
inlinenoexcept |
Definition at line 124 of file shm_atomic.h.
Referenced by shm_atomic< T, TableType >::operator&=().
|
inlinenoexcept |
Definition at line 130 of file shm_atomic.h.
Referenced by shm_atomic< T, TableType >::operator|=().
|
inlinenoexcept |
Definition at line 117 of file shm_atomic.h.
Referenced by shm_atomic< T, TableType >::operator--(), shm_atomic< T, TableType >::operator--(), and shm_atomic< T, TableType >::operator-=().
|
inlinenoexcept |
Definition at line 136 of file shm_atomic.h.
Referenced by shm_atomic< T, TableType >::operator^=().
|
inlinenoexcept |
Definition at line 78 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 88 of file shm_atomic.h.
Referenced by grid_simulation_example(), shm_atomic< T, TableType >::operator T(), and particle_simulation_example().
|
inlinenoexcept |
Definition at line 207 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 220 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 216 of file shm_atomic.h.
|
inlinenoexcept |
Definition at line 146 of file shm_atomic.h.
References shm_atomic< T, TableType >::load().
|
inlinenoexcept |
Definition at line 190 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_and().
|
inlinenoexcept |
Definition at line 153 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_add().
|
inlinenoexcept |
Definition at line 159 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_add().
|
inlinenoexcept |
Definition at line 178 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_add().
|
inlinenoexcept |
Definition at line 165 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_sub().
|
inlinenoexcept |
Definition at line 171 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_sub().
|
inlinenoexcept |
Definition at line 184 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_sub().
|
inlinenoexcept |
Definition at line 141 of file shm_atomic.h.
References shm_atomic< T, TableType >::store().
|
inlinenoexcept |
Definition at line 202 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_xor().
|
inlinenoexcept |
Definition at line 196 of file shm_atomic.h.
References shm_atomic< T, TableType >::fetch_or().
|
inlinenoexcept |
Definition at line 84 of file shm_atomic.h.
Referenced by shm_atomic< T, TableType >::operator=().
|
inlinenoexcept |
Definition at line 212 of file shm_atomic.h.
|
staticconstexpr |
Definition at line 82 of file shm_atomic.h.