proxygen
|
#include <TimedMutex.h>
Classes | |
struct | MutexWaiter |
class | ReadHolder |
class | WriteHolder |
Public Member Functions | |
TimedRWMutex ()=default | |
~TimedRWMutex ()=default | |
TimedRWMutex (const TimedRWMutex &rhs)=delete | |
TimedRWMutex & | operator= (const TimedRWMutex &rhs)=delete |
TimedRWMutex (TimedRWMutex &&rhs)=delete | |
TimedRWMutex & | operator= (TimedRWMutex &&rhs)=delete |
void | read_lock () |
template<typename Rep , typename Period > | |
bool | timed_read_lock (const std::chrono::duration< Rep, Period > &duration) |
bool | try_read_lock () |
void | write_lock () |
template<typename Rep , typename Period > | |
bool | timed_write_lock (const std::chrono::duration< Rep, Period > &duration) |
bool | try_write_lock () |
void | lock () |
void | unlock () |
void | downgrade () |
Private Types | |
enum | State { State::UNLOCKED, State::READ_LOCKED, State::WRITE_LOCKED } |
typedef boost::intrusive::list_member_hook | MutexWaiterHookType |
typedef boost::intrusive::member_hook< MutexWaiter, MutexWaiterHookType,&MutexWaiter::hook > | MutexWaiterHook |
typedef boost::intrusive::list< MutexWaiter, MutexWaiterHook, boost::intrusive::constant_time_size< true > > | MutexWaiterList |
Private Member Functions | |
void | verify_unlocked_properties () |
Private Attributes | |
folly::SpinLock | lock_ |
State | state_ = State::UNLOCKED |
uint32_t | readers_ = 0 |
MutexWaiterList | write_waiters_ |
MutexWaiterList | read_waiters_ |
A readers-writer lock which allows multiple readers to hold the lock simultaneously or only one writer.
NOTE: This is a reader-preferred RWLock i.e. readers are give priority when there are both readers and writers waiting to get the lock.
Definition at line 92 of file TimedMutex.h.
|
private |
Definition at line 211 of file TimedMutex.h.
|
private |
Definition at line 201 of file TimedMutex.h.
|
private |
Definition at line 217 of file TimedMutex.h.
|
strongprivate |
Enumerator | |
---|---|
UNLOCKED | |
READ_LOCKED | |
WRITE_LOCKED |
Definition at line 195 of file TimedMutex.h.
|
default |
|
default |
|
delete |
|
delete |
void folly::fibers::TimedRWMutex< BatonType >::downgrade | ( | ) |
Definition at line 320 of file TimedMutex-inl.h.
References folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::baton, folly::gen::guard(), and folly::fibers::TimedMutex::lock_.
|
inline |
|
delete |
|
delete |
void folly::fibers::TimedRWMutex< BatonType >::read_lock | ( | ) |
Definition at line 157 of file TimedMutex-inl.h.
References folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::baton, folly::fibers::TimedMutex::lock_, and folly::ulock().
bool folly::fibers::TimedRWMutex< BatonType >::timed_read_lock | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
Definition at line 177 of file TimedMutex-inl.h.
References folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::baton, folly::gen::guard(), folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::hook, folly::fibers::TimedMutex::lock_, and folly::ulock().
bool folly::fibers::TimedRWMutex< BatonType >::timed_write_lock | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
Definition at line 239 of file TimedMutex-inl.h.
References folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::baton, folly::gen::guard(), folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::hook, folly::fibers::TimedMutex::lock_, and folly::ulock().
bool folly::fibers::TimedRWMutex< BatonType >::try_read_lock | ( | ) |
Definition at line 209 of file TimedMutex-inl.h.
References folly::gen::guard(), and folly::fibers::TimedMutex::lock_.
bool folly::fibers::TimedRWMutex< BatonType >::try_write_lock | ( | ) |
Definition at line 268 of file TimedMutex-inl.h.
References folly::gen::guard(), and folly::fibers::TimedMutex::lock_.
void folly::fibers::TimedRWMutex< BatonType >::unlock | ( | ) |
Definition at line 279 of file TimedMutex-inl.h.
References folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::baton, folly::gen::guard(), and folly::fibers::TimedMutex::lock_.
|
inlineprivate |
Definition at line 188 of file TimedMutex.h.
void folly::fibers::TimedRWMutex< BatonType >::write_lock | ( | ) |
Definition at line 224 of file TimedMutex-inl.h.
References folly::fibers::TimedRWMutex< BatonType >::MutexWaiter::baton, folly::fibers::TimedMutex::lock_, and folly::ulock().
|
private |
Definition at line 219 of file TimedMutex.h.
|
private |
Definition at line 228 of file TimedMutex.h.
|
private |
Definition at line 223 of file TimedMutex.h.
|
private |
Definition at line 221 of file TimedMutex.h.
|
private |
Definition at line 225 of file TimedMutex.h.