22 case memory_order::relaxed:
24 case memory_order::consume:
26 case memory_order::acquire:
28 case memory_order::release:
30 case memory_order::acq_rel:
32 case memory_order::seq_cst:
42template <
typename T, device_address_space address>
47template <
typename T, device_address_space address>
50 : m_ptr(parent.m_ptr) {}
52template <
typename T, device_address_space address>
60template <
typename T, device_address_space address>
67template <
typename T, device_address_space address>
74template <
typename T, device_address_space address>
82template <
typename T, device_address_space address>
86 if (
order == memory_order::acq_rel) {
88 memory_order::acquire);
89 }
else if (
order == memory_order::release) {
91 memory_order::relaxed);
97template <
typename T, device_address_space address>
103 failure != memory_order::acq_rel);
111template <
typename T, device_address_space address>
119template <
typename T, device_address_space address>
127template <
typename T, device_address_space address>
135template <
typename T, device_address_space address>
143template <
typename T, device_address_space address>
Custom implementation for atomic operations using "POSIX" built-ins.
Definition posix_device_atomic_ref.hpp:27
VECMEM_HOST value_type fetch_add(value_type data, memory_order order=memory_order::seq_cst) const
Add a chosen value to the stored variable.
Definition posix_device_atomic_ref.ipp:112
VECMEM_HOST bool compare_exchange_strong(reference expected, value_type desired, memory_order success, memory_order failure) const
Compare against the current value, and exchange only if different.
Definition posix_device_atomic_ref.ipp:98
VECMEM_HOST void store(value_type data, memory_order order=memory_order::seq_cst) const
Set the variable to the desired value.
Definition posix_device_atomic_ref.ipp:61
VECMEM_HOST value_type fetch_or(value_type data, memory_order order=memory_order::seq_cst) const
Replace the current value with the specified value OR-d to it.
Definition posix_device_atomic_ref.ipp:136
posix_device_atomic_ref & operator=(const posix_device_atomic_ref &)=delete
Disable the assignment operator.
VECMEM_HOST posix_device_atomic_ref(reference ref)
Constructor, with a pointer to the managed variable.
Definition posix_device_atomic_ref.ipp:43
VECMEM_HOST value_type fetch_and(value_type data, memory_order order=memory_order::seq_cst) const
Replace the current value with the specified value AND-ed to it.
Definition posix_device_atomic_ref.ipp:128
VECMEM_HOST value_type exchange(value_type data, memory_order order=memory_order::seq_cst) const
Exchange the current value of the variable with a different one.
Definition posix_device_atomic_ref.ipp:75
VECMEM_HOST value_type load(memory_order order=memory_order::seq_cst) const
Get the value of the variable.
Definition posix_device_atomic_ref.ipp:68
VECMEM_HOST bool compare_exchange_strong(reference expected, value_type desired, memory_order order=memory_order::seq_cst) const
Compare against the current value, and exchange only if different.
Definition posix_device_atomic_ref.ipp:83
T value_type
Type managed by the object.
Definition posix_device_atomic_ref.hpp:34
VECMEM_HOST value_type fetch_sub(value_type data, memory_order order=memory_order::seq_cst) const
Substitute a chosen value from the stored variable.
Definition posix_device_atomic_ref.ipp:120
VECMEM_HOST value_type fetch_xor(value_type data, memory_order order=memory_order::seq_cst) const
Replace the current value with the specified value XOR-d to it.
Definition posix_device_atomic_ref.ipp:144
value_type & reference
Reference to a value given by the user.
Definition posix_device_atomic_ref.hpp:40
constexpr int memorder_to_posix_builtin(memory_order o)
Convert a memory order to the corresponding builtin memory order.
Definition posix_device_atomic_ref.ipp:20
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35
memory_order
Custom (dummy) definition for the memory order.
Definition memory_order.hpp:31