|
mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
A thread-safe wrapper for shared data with mutex protection. More...
#include <owning_mutex.hpp>
Public Member Functions | |
| OwningMutex ()=default | |
| Construct with default-initialized data. | |
| OwningMutex (const T &val) | |
| Construct by copying the data. | |
| OwningMutex (T &&val) | |
| Construct by moving the data. | |
| ~OwningMutex ()=default | |
| Default destructor. | |
| OwningMutex (const OwningMutex &)=delete | |
| OwningMutex is immovable. | |
| OwningMutex & | operator= (const OwningMutex &)=delete |
| OwningMutex is immovable. | |
| OwningMutex (OwningMutex &&)=delete | |
| OwningMutex is immovable. | |
| OwningMutex & | operator= (OwningMutex &&)=delete |
| OwningMutex is immovable. | |
| OwningMutexGuard< true > | acquire () |
| Acquires a mutable guard for the OwningMutex. | |
| OwningMutexGuard< false > | acquire () const |
| Acquires a const guard for the OwningMutex. | |
| T | load () const |
| Loads the current value of the data. | |
| void | store (T val) |
| Stores a new value into the data. | |
A thread-safe wrapper for shared data with mutex protection.
| T | The type of data to be protected by the mutex. |
| Mutex | The mutex type to use (defaults to std::mutex). |
|
default |
Construct with default-initialized data.
|
inline |
Construct by copying the data.
| val | The value to copy into the OwningMutex. |
|
inline |
Construct by moving the data.
| val | The value to move into the OwningMutex. |
|
inline |
Acquires a mutable guard for the OwningMutex.
|
inline |
Acquires a const guard for the OwningMutex.
|
inlinenodiscard |
Loads the current value of the data.
|
inline |
Stores a new value into the data.
| val | The value to store. |