|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Value wrapper that pairs an object with the mutex protecting it. More...
#include <src/sync.h>
Public Types | |
| using | mutex_t = M |
| Mutex type used to protect the stored value. | |
| using | value_t = T |
| Type stored behind the synchronization wrapper. | |
Public Member Functions | |
| std::lock_guard< mutex_t > | lock () |
| Acquire the underlying lock or keyed mutex. | |
| value_t & | operator* () |
| Dereference the protected value. | |
| const value_t & | operator* () const |
| Dereference the protected value. | |
| value_t * | operator-> () |
| Access the protected value directly. | |
| sync_t & | operator= (const value_t &val) noexcept |
| Copy-assign the protected value while holding this wrapper's lock. | |
| sync_t & | operator= (sync_t &&other) noexcept |
| Move another synchronized value into this instance while locking both wrappers. | |
| sync_t & | operator= (sync_t &other) noexcept |
| Copy another synchronized value into this instance while locking both wrappers. | |
| template<class V > | |
| sync_t & | operator= (V &&val) |
| Assign a new value while holding this wrapper's lock. | |
| sync_t & | operator= (value_t &&val) noexcept |
| Move-assign the protected value while holding this wrapper's lock. | |
| template<class... Args> | |
| sync_t (Args &&...args) | |
| Initialize the protected object from forwarded arguments. | |
Public Attributes | |
| value_t | raw |
| Protected value accessed while this helper's lock is held. | |
Value wrapper that pairs an object with the mutex protecting it.
|
inline |
Initialize the protected object from forwarded arguments.
| args | Arguments forwarded to the protected object's constructor. |
|
inline |
Acquire the underlying lock or keyed mutex.
|
inline |
Dereference the protected value.
|
inline |
Dereference the protected value.
|
inline |
Access the protected value directly.
|
inlinenoexcept |
Copy-assign the protected value while holding this wrapper's lock.
| val | Value assigned to the synchronized object. |
|
inlinenoexcept |
Move another synchronized value into this instance while locking both wrappers.
| other | Source object whose state is copied or moved into this object. |
|
inlinenoexcept |
Copy another synchronized value into this instance while locking both wrappers.
| other | Source object whose state is copied or moved into this object. |
|
inline |
Assign a new value while holding this wrapper's lock.
| val | Value assigned to the synchronized object. |
|
inlinenoexcept |
Move-assign the protected value while holding this wrapper's lock.
| val | Value assigned to the synchronized object. |