High-performance read-write-spinlock, see RWSpinLock.hpp for details.
More...
#include <RWSpinLock.hpp>
High-performance read-write-spinlock, see RWSpinLock.hpp for details.
◆ RWSpinLock() [1/2]
constexpr Memory::RWSpinLock::RWSpinLock |
( |
| ) |
|
|
inlineconstexpr |
◆ RWSpinLock() [2/2]
Memory::RWSpinLock::RWSpinLock |
( |
RWSpinLock const & |
| ) |
|
|
delete |
◆ operator=()
◆ lock()
void Memory::RWSpinLock::lock |
( |
| ) |
|
|
inline |
◆ unlock()
void Memory::RWSpinLock::unlock |
( |
| ) |
|
|
inline |
Writer is responsible for clearing up both the UPGRADED and WRITER bits.
◆ lock_shared()
void Memory::RWSpinLock::lock_shared |
( |
| ) |
|
|
inline |
◆ unlock_shared()
void Memory::RWSpinLock::unlock_shared |
( |
| ) |
|
|
inline |
◆ unlock_and_lock_shared()
void Memory::RWSpinLock::unlock_and_lock_shared |
( |
| ) |
|
|
inline |
Downgrade the lock from writer status to reader status.
◆ lock_upgrade()
void Memory::RWSpinLock::lock_upgrade |
( |
| ) |
|
|
inline |
◆ unlock_upgrade()
void Memory::RWSpinLock::unlock_upgrade |
( |
| ) |
|
|
inline |
◆ unlock_upgrade_and_lock()
void Memory::RWSpinLock::unlock_upgrade_and_lock |
( |
| ) |
|
|
inline |
unlock upgrade and try to acquire write lock
◆ unlock_upgrade_and_lock_shared()
void Memory::RWSpinLock::unlock_upgrade_and_lock_shared |
( |
| ) |
|
|
inline |
unlock upgrade and read lock atomically
◆ unlock_and_lock_upgrade()
void Memory::RWSpinLock::unlock_and_lock_upgrade |
( |
| ) |
|
|
inline |
write unlock and upgrade lock atomically
◆ try_lock()
bool Memory::RWSpinLock::try_lock |
( |
| ) |
|
|
inline |
Attempt to acquire writer permission. Return false if we didn't get it.
◆ try_lock_shared()
bool Memory::RWSpinLock::try_lock_shared |
( |
| ) |
|
|
inline |
Try to get reader permission on the lock. This can fail if we find out someone is a writer or upgrader.
Setting the UPGRADED bit would allow a writer-to-be to indicate its intention to write and block any new readers while waiting for existing readers to finish and release their read locks. This helps avoid starving writers (promoted from upgraders).
◆ try_unlock_upgrade_and_lock()
bool Memory::RWSpinLock::try_unlock_upgrade_and_lock |
( |
| ) |
|
|
inline |
try to unlock upgrade and write lock atomically
◆ try_lock_upgrade()
bool Memory::RWSpinLock::try_lock_upgrade |
( |
| ) |
|
|
inline |
try to acquire an upgradable lock.
- Note
- when failed, we cannot flip the UPGRADED bit back, as in this case there is either another upgrade lock or a write lock. If it's a write lock, the bit will get cleared up when that lock's done with unlock().
◆ bits()
int32_t Memory::RWSpinLock::bits |
( |
| ) |
const |
|
inline |
mainly for debugging purposes.
The documentation for this class was generated from the following file: