libASPL
|
Read lock. More...
#include <aspl/DoubleBuffer.hpp>
Public Member Functions | |
ReadLock (const DoubleBuffer &doubleBuffer) | |
Acquire the lock. Non-blocking and lock-free. May spin for a while if a setter is running concurrently, but wont block if the setter is suspended somewhere on the halfway. | |
~ReadLock () | |
Release the lock. | |
ReadLock (ReadLock &&other) | |
Move lock. | |
ReadLock (const ReadLock &)=delete | |
ReadLock & | operator= (const ReadLock &)=delete |
ReadLock & | operator= (ReadLock &&)=delete |
const T & | GetReference () const |
Get read-only reference to the value. The reference may be used until read lock destructor is called. The referred value is guaranteed to be immutable until that. | |
Read lock.
Similar to scoped locks like std::lock_guard, but also provides GetReference() method to access the value.
While the lock is alive, it's safe to access the data for reading.
Definition at line 113 of file DoubleBuffer.hpp.
|
inline |
Acquire the lock. Non-blocking and lock-free. May spin for a while if a setter is running concurrently, but wont block if the setter is suspended somewhere on the halfway.
Definition at line 120 of file DoubleBuffer.hpp.
|
inline |
Release the lock.
Definition at line 166 of file DoubleBuffer.hpp.
|
inline |
Move lock.
Definition at line 174 of file DoubleBuffer.hpp.
|
inline |
Get read-only reference to the value. The reference may be used until read lock destructor is called. The referred value is guaranteed to be immutable until that.
Definition at line 187 of file DoubleBuffer.hpp.