#include <spinlock.h>
The ScopedReadLock class acquires a read lock to the specified mutex upon creation and releases this upon destruction (usually at the end of a code block. This simplifies cases where your code contains many return statements where you'd otherwise have to manually unlock before returning. Only use ScopedReadLock for a short block of your code.
THREADSAFE.
Public Member Functions | |
ScopedReadLock (RWSpinlock &lock) | |
ScopedReadLock (ScopedReadLock &&src) | |
~ScopedReadLock () | |
Private Member Functions | |
MAXON_DISALLOW_COPY_AND_ASSIGN (ScopedReadLock) | |
Private Attributes | |
RWSpinlock * | _lock |
|
explicit |
Acquires read access to the specified lock (and releases it upon destruction).
[in] | lock | The lock to be acquired. |
ScopedReadLock | ( | ScopedReadLock && | src | ) |
Move constructor.
~ScopedReadLock | ( | ) |
Releases the lock on destruction.
|
private |
|
private |