36#ifndef LDVC_ATOMIC_HPP
37#define LDVC_ATOMIC_HPP
61 std::lock_guard<std::mutex> lock(mutex);
62 var.store(value, std::memory_order_relaxed);
82 std::lock_guard<std::mutex> lock(mutex);
83 var.store(T{}, std::memory_order_relaxed);
105 std::lock_guard<std::mutex> lock(mutex);
106 var.fetch_add(arg, std::memory_order_relaxed);
129 std::lock_guard<std::mutex> lock(mutex);
130 var.fetch_sub(arg, std::memory_order_relaxed);
153 std::lock_guard<std::mutex> lock(mutex);
154 var.fetch_and(arg, std::memory_order_relaxed);
176 std::lock_guard<std::mutex> lock(mutex);
177 var.fetch_or(arg, std::memory_order_relaxed);
200 std::lock_guard<std::mutex> lock(mutex);
201 var.fetch_xor(arg, std::memory_order_relaxed);
225 std::lock_guard<std::mutex> lock(mutex);
226 return var.exchange(new_value, std::memory_order_relaxed);
247 std::lock_guard<std::mutex> lock(mutex);
248 return var.load(std::memory_order_relaxed);
270 std::lock_guard<std::mutex> lock(mutex);
271 var.store(new_value, std::memory_order_relaxed);
void ldvc_atomic_inc(std::atomic< T > &var, std::mutex &mutex, T arg)
Atomically increments the value of an std::atomic variable by the specified amount under the protecti...
T ldvc_atomic_exchange(std::atomic< T > &var, std::mutex &mutex, T new_value)
Atomically exchanges the value of an std::atomic variable with a new value under the protection of a ...
void ldvc_atomic_dec(std::atomic< T > &var, std::mutex &mutex, T arg)
Atomically decrements the value of an std::atomic variable by the specified amount under the protecti...
void ldvc_atomic_create(std::atomic< T > &var, std::mutex &mutex, T value)
Initializes an std::atomic variable with the specified initial value under the protection of a mutex.
void ldvc_atomic_xor(std::atomic< T > &var, std::mutex &mutex, T arg)
Performs a bitwise XOR operation on an std::atomic variable with the specified value under the protec...
void ldvc_atomic_store(std::atomic< T > &var, std::mutex &mutex, T new_value)
Atomically stores a new value in an std::atomic variable under the protection of a mutex.
void ldvc_atomic_and(std::atomic< T > &var, std::mutex &mutex, T arg)
Performs a bitwise AND operation on an std::atomic variable with the specified value under the protec...
void ldvc_atomic_delete(std::atomic< T > &var, std::mutex &mutex)
Resets an std::atomic variable to its default-constructed value under the protection of a mutex.
T ldvc_atomic_load(const std::atomic< T > &var, std::mutex &mutex)
Atomically loads the value of an std::atomic variable under the protection of a mutex.
void ldvc_atomic_or(std::atomic< T > &var, std::mutex &mutex, T arg)
Performs a bitwise OR operation on an std::atomic variable with the specified value under the protect...