| 
    ladivic
    
   | 
 
Provides utilities for atomic operations with mutex protection in C++. More...
#include <atomic>#include <mutex>
Go to the source code of this file.
Functions | |
| template<typename T > | |
| 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.   | |
| template<typename T > | |
| 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.   | |
| template<typename T > | |
| 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 protection of a mutex.   | |
| template<typename T > | |
| 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 protection of a mutex.   | |
| template<typename T > | |
| 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 protection of a mutex.   | |
| template<typename T > | |
| 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 protection of a mutex.   | |
| template<typename T > | |
| 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 protection of a mutex.   | |
| template<typename T > | |
| 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 mutex.   | |
| template<typename T > | |
| 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.   | |
| template<typename T > | |
| 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.   | |
Provides utilities for atomic operations with mutex protection in C++.
This header file defines functions for performing atomic operations on std::atomic variables with the protection of a mutex. These functions ensure thread safety while allowing atomicity for operations such as incrementing, decrementing, bitwise operations, exchange, load, and store.
Definition in file ldvc_atomic.hpp.
| 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 protection of a mutex. 
This function performs a bitwise AND operation on an std::atomic variable var with the specified value arg under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be bitwise ANDed. | 
| mutex | The mutex for thread safety. | 
| arg | The value for the bitwise AND operation. | 
Definition at line 151 of file ldvc_atomic.hpp.
| 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. 
This function initializes an std::atomic variable var with the specified initial value value under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be initialized. | 
| mutex | The mutex for thread safety. | 
| value | The initial value for the atomic variable. | 
Definition at line 59 of file ldvc_atomic.hpp.
| 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 protection of a mutex. 
This function atomically decrements the value of an std::atomic variable var by the specified amount arg under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be decremented. | 
| mutex | The mutex for thread safety. | 
| arg | The amount by which to decrement the atomic variable. | 
Definition at line 127 of file ldvc_atomic.hpp.
| 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. 
This function resets an std::atomic variable var to its default-constructed value under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be reset. | 
| mutex | The mutex for thread safety. | 
Definition at line 80 of file ldvc_atomic.hpp.
| 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 mutex. 
This function atomically exchanges the value of an std::atomic variable var with the specified new value new_value under the protection of the provided mutex mutex. It returns the previous value of the atomic variable.
| T | The type of the atomic variable. | 
| var | The atomic variable to be exchanged. | 
| mutex | The mutex for thread safety. | 
| new_value | The new value to be stored in the atomic variable. | 
Definition at line 223 of file ldvc_atomic.hpp.
| 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 protection of a mutex. 
This function atomically increments the value of an std::atomic variable var by the specified amount arg under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be incremented. | 
| mutex | The mutex for thread safety. | 
| arg | The amount by which to increment the atomic variable. | 
Definition at line 103 of file ldvc_atomic.hpp.
| 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. 
This function atomically loads the value of an std::atomic variable var under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be loaded. | 
| mutex | The mutex for thread safety. | 
Definition at line 245 of file ldvc_atomic.hpp.
| 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 protection of a mutex. 
This function performs a bitwise OR operation on an std::atomic variable var with the specified value arg under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be bitwise ORed. | 
| mutex | The mutex for thread safety. | 
| arg | The value for the bitwise OR operation. | 
Definition at line 174 of file ldvc_atomic.hpp.
| 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. 
This function atomically stores the specified new value new_value in an std::atomic variable var under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be stored. | 
| mutex | The mutex for thread safety. | 
| new_value | The new value to be stored in the atomic variable. | 
Definition at line 268 of file ldvc_atomic.hpp.
| 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 protection of a mutex. 
This function performs a bitwise XOR operation on an std::atomic variable var with the specified value arg under the protection of the provided mutex mutex.
| T | The type of the atomic variable. | 
| var | The atomic variable to be bitwise XORed. | 
| mutex | The mutex for thread safety. | 
| arg | The value for the bitwise XOR operation. | 
Definition at line 198 of file ldvc_atomic.hpp.