9 #ifndef CPPCOMMON_THREADS_RW_LOCK_H
10 #define CPPCOMMON_THREADS_RW_LOCK_H
116 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
117 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
119 #if defined(__APPLE__)
120 static const size_t StorageSize = 256;
122 static const size_t StorageSize = 56;
124 static const size_t StorageAlign = 8;
125 alignas(StorageAlign) std::byte _storage[StorageSize];
Read/Write lock synchronization primitive.
RWLock & operator=(const RWLock &)=delete
RWLock & operator=(RWLock &&lock)=delete
bool TryLockWriteUntil(const UtcTimestamp ×tamp)
Try to acquire write lock until the given timestamp.
void UnlockRead()
Release read lock.
void LockWrite()
Acquire write lock with block.
void UnlockWrite()
Release write lock.
bool TryLockRead()
Try to acquire read lock without block.
RWLock(RWLock &&lock)=delete
void LockRead()
Acquire read lock with block.
bool TryLockReadUntil(const UtcTimestamp ×tamp)
Try to acquire read lock until the given timestamp.
RWLock(const RWLock &)=delete
bool TryLockReadFor(const Timespan ×pan)
Try to acquire read lock for the given timespan.
bool TryLockWrite()
Try to acquire write lock without block.
bool TryLockWriteFor(const Timespan ×pan)
Try to acquire write lock for the given timespan.
Locker synchronization primitive definition.
C++ Common project definitions.