CatapultServer
v0.5.0.1 (Elephant)
|
Classes | |
class | LockGuard |
Base class for RAII lock guards. More... | |
struct | ReaderLockGuard |
A reader lock guard. More... | |
struct | WriterLockGuard |
A writer lock guard. More... | |
Public Member Functions | |
BasicSpinReaderWriterLock () | |
Creates an unlocked lock. More... | |
ReaderLockGuard | acquireReader () |
Blocks until a reader lock can be acquired. More... | |
bool | isWriterPending () const |
Returns true if there is a pending (or active) writer. More... | |
bool | isWriterActive () const |
Returns true if there is an active writer. More... | |
bool | isReaderActive () const |
Returns true if there is an active reader. More... | |
Private Member Functions | |
bool | isSet (uint16_t mask) const |
Static Private Member Functions | |
static void | Yield () |
Private Attributes | |
std::atomic< uint16_t > | m_value |
Static Private Attributes | |
static constexpr uint16_t | Active_Writer_Flag = 0x8000 |
static constexpr uint16_t | Pending_Writer_Mask = 0x7F00 |
static constexpr uint16_t | Reader_Mask = 0x00FF |
static constexpr uint16_t | Writer_Mask = Pending_Writer_Mask | Active_Writer_Flag |
static constexpr uint16_t | Active_Reader_Increment = 0x0001 |
static constexpr uint16_t | Pending_Writer_Increment = 0x0100 |
Custom reader writer lock implemented by using an atomic that allows multiple readers and a single writer and prefers writers.
|
inline |
Creates an unlocked lock.
|
inline |
Blocks until a reader lock can be acquired.
|
inline |
Returns true
if there is an active reader.
|
inlineprivate |
|
inline |
Returns true
if there is an active writer.
|
inline |
Returns true
if there is a pending (or active) writer.
|
inlinestaticprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |