10 template<
class Lockable>
class SharedLock;
64 struct State {
enum t {
71 bool tryLockShared_priv();
73 bool isShared()
const {
return (_state & ~State::unique) != 0; }
77 Atomic<Thread::ThreadId> _owner;
79 Atomic<int> _waitCount;
A scoped lock that references any lockable. Locks on construction and unlocks on destruction.
Definition: Mutex.h:10
bool tryLockShared(MonoClock::Duration time)
Attempt to acquire the shared reader lock for an amount of time. Returns true if the lock was acquire...
Definition: SharedMutex.h:53
static TimePoint now()
Get current time.
Definition: Clock.h:48
UniqueLock< SharedMutex > Scoped
Definition: SharedMutex.h:21
Super::TimePoint TimePoint
Definition: Clock.h:40
SharedMutex()
Definition: SharedMutex.h:24
bool tryLock()
Attempt to acquire the unique writer lock, returns immediately. Returns true if the lock was acquired...
Definition: SharedMutex.cpp:48
void unlock()
Release the unique writer lock.
Definition: SharedMutex.cpp:28
void lock()
Acquire the unique writer lock. Thread suspends until lock is available and all readers release the s...
Definition: SharedMutex.cpp:17
Super::ThreadId ThreadId
Definition: Thread.h:140
SharedLock< SharedMutex > SharedScoped
Definition: SharedMutex.h:22
bool tryLock(MonoClock::Duration time)
Attempt to acquire the unique writer lock for an amount of time. Returns true if the lock was acquire...
Definition: SharedMutex.h:41
void unlockAndLockShared()
Atomically unlock unique writer lock and acquire shared reader lock without blocking.
Definition: SharedMutex.cpp:115
~SharedMutex()
Definition: SharedMutex.h:28
bool tryLockShared()
Attempt to acquire the shared reader lock, returns immediately. Returns true if the lock was acquired...
Definition: SharedMutex.cpp:98
SharedMutex(const SharedMutex &)
Can't copy, silently inits to default.
Definition: SharedMutex.h:26
SharedMutex & operator=(const SharedMutex &)
Can't copy, silently does nothing.
Definition: SharedMutex.h:31
TimePoint::Duration Duration
Definition: Clock.h:41
A scoped lock that references a shared mutex. Does a shared read lock on construction and unlocks on ...
Definition: Shared.h:15
void lockShared()
Acquire the shared reader lock. Thread suspends until writer lock has been released.
Definition: SharedMutex.cpp:66
Global Honeycomb namespace.
A thread lock for shared data where there may be many readers and one writer.
Definition: SharedMutex.h:18
void unlockShared()
Release the shared reader lock.
Definition: SharedMutex.cpp:76