proxygen
|
#include <SharedMutex.h>
Classes | |
class | ReadHolder |
class | UpgradeHolder |
struct | WaitForDuration |
struct | WaitForever |
struct | WaitNever |
struct | WaitUntilDeadline |
class | WriteHolder |
Public Types | |
typedef Tag_ | Tag |
typedef SharedMutexToken | Token |
typedef Atom< uintptr_t > | DeferredReaderSlot |
Public Member Functions | |
constexpr | SharedMutexImpl () noexcept |
SharedMutexImpl (const SharedMutexImpl &)=delete | |
SharedMutexImpl (SharedMutexImpl &&)=delete | |
SharedMutexImpl & | operator= (const SharedMutexImpl &)=delete |
SharedMutexImpl & | operator= (SharedMutexImpl &&)=delete |
~SharedMutexImpl () | |
void | lock () |
bool | try_lock () |
template<class Rep , class Period > | |
bool | try_lock_for (const std::chrono::duration< Rep, Period > &duration) |
template<class Clock , class Duration > | |
bool | try_lock_until (const std::chrono::time_point< Clock, Duration > &absDeadline) |
void | unlock () |
void | lock_shared () |
void | lock_shared (Token &token) |
bool | try_lock_shared () |
bool | try_lock_shared (Token &token) |
template<class Rep , class Period > | |
bool | try_lock_shared_for (const std::chrono::duration< Rep, Period > &duration) |
template<class Rep , class Period > | |
bool | try_lock_shared_for (const std::chrono::duration< Rep, Period > &duration, Token &token) |
template<class Clock , class Duration > | |
bool | try_lock_shared_until (const std::chrono::time_point< Clock, Duration > &absDeadline) |
template<class Clock , class Duration > | |
bool | try_lock_shared_until (const std::chrono::time_point< Clock, Duration > &absDeadline, Token &token) |
void | unlock_shared () |
void | unlock_shared (Token &token) |
void | unlock_and_lock_shared () |
void | unlock_and_lock_shared (Token &token) |
void | lock_upgrade () |
bool | try_lock_upgrade () |
template<class Rep , class Period > | |
bool | try_lock_upgrade_for (const std::chrono::duration< Rep, Period > &duration) |
template<class Clock , class Duration > | |
bool | try_lock_upgrade_until (const std::chrono::time_point< Clock, Duration > &absDeadline) |
void | unlock_upgrade () |
void | unlock_upgrade_and_lock () |
void | unlock_upgrade_and_lock_shared () |
void | unlock_upgrade_and_lock_shared (Token &token) |
void | unlock_and_lock_upgrade () |
Static Public Attributes | |
static constexpr bool | kReaderPriority = ReaderPriority |
static constexpr uint32_t | kMaxDeferredReaders = 64 |
static constexpr uint32_t | kDeferredSearchDistance = 2 |
static constexpr uint32_t | kDeferredSeparationFactor = 4 |
Private Types | |
typedef folly::detail::Futex< Atom > | Futex |
Private Member Functions | |
void | annotateLazyCreate () |
void | annotateDestroy () |
void | annotateAcquired (annotate_rwlock_level w) |
void | annotateTryAcquired (bool result, annotate_rwlock_level w) |
void | annotateReleased (annotate_rwlock_level w) |
template<class WaitContext > | |
bool | lockExclusiveImpl (uint32_t preconditionGoalMask, WaitContext &ctx) |
template<class WaitContext > | |
bool | lockExclusiveImpl (uint32_t &state, uint32_t preconditionGoalMask, WaitContext &ctx) |
template<class WaitContext > | |
bool | waitForZeroBits (uint32_t &state, uint32_t goal, uint32_t waitMask, WaitContext &ctx) |
template<class WaitContext > | |
bool | yieldWaitForZeroBits (uint32_t &state, uint32_t goal, uint32_t waitMask, WaitContext &ctx) |
template<class WaitContext > | |
bool | futexWaitForZeroBits (uint32_t &state, uint32_t goal, uint32_t waitMask, WaitContext &ctx) |
void | wakeRegisteredWaiters (uint32_t &state, uint32_t wakeMask) |
void | wakeRegisteredWaitersImpl (uint32_t &state, uint32_t wakeMask) |
void | futexWakeAll (uint32_t wakeMask) |
DeferredReaderSlot * | deferredReader (uint32_t slot) |
uintptr_t | tokenfulSlotValue () |
uintptr_t | tokenlessSlotValue () |
bool | slotValueIsThis (uintptr_t slotValue) |
template<class WaitContext > | |
void | applyDeferredReaders (uint32_t &state, WaitContext &ctx) |
template<class WaitContext > | |
void | applyDeferredReaders (uint32_t &state, WaitContext &ctx, uint32_t slot) |
template<class WaitContext > | |
bool | lockSharedImpl (Token *token, WaitContext &ctx) |
template<class WaitContext > | |
bool | lockSharedImpl (uint32_t &state, Token *token, WaitContext &ctx) |
void | cleanupTokenlessSharedDeferred (uint32_t &state) |
bool | tryUnlockTokenlessSharedDeferred () |
bool | tryUnlockSharedDeferred (uint32_t slot) |
uint32_t | unlockSharedInline () |
template<class WaitContext > | |
bool | lockUpgradeImpl (WaitContext &ctx) |
Private Attributes | |
Futex | state_ {} |
Static Private Attributes | |
static constexpr uint32_t | kIncrHasS = 1 << 11 |
static constexpr uint32_t | kHasS = ~(kIncrHasS - 1) |
static constexpr uint32_t | kAnnotationCreated = 1 << 10 |
static constexpr uint32_t | kMayDefer = 1 << 9 |
static constexpr uint32_t | kPrevDefer = 1 << 8 |
static constexpr uint32_t | kHasE = 1 << 7 |
static constexpr uint32_t | kBegunE = 1 << 6 |
static constexpr uint32_t | kHasU = 1 << 5 |
static constexpr uint32_t | kHasSolo = kHasE | kBegunE | kHasU |
static constexpr uint32_t | kWaitingNotS = 1 << 4 |
static constexpr uint32_t | kWaitingESingle = 1 << 2 |
static constexpr uint32_t | kWaitingEMultiple = 1 << 3 |
static constexpr uint32_t | kWaitingE = kWaitingESingle | kWaitingEMultiple |
static constexpr uint32_t | kWaitingU = 1 << 1 |
static constexpr uint32_t | kWaitingS = 1 << 0 |
static constexpr uint32_t | kWaitingAny |
static constexpr uint32_t | kNumSharedToStartDeferring = 2 |
static constexpr uint32_t | kMaxSpinCount = !BlockImmediately ? 1000 : 2 |
static constexpr uint32_t | kMaxSoftYieldCount = !BlockImmediately ? 1000 : 0 |
static constexpr uint32_t | kTokenStackTLSCapacity = 2 |
static constexpr uintptr_t | kTokenless = 0x1 |
static FOLLY_TLS uint32_t | tls_lastTokenlessSlot = 0 |
static FOLLY_TLS uint32_t | tls_lastDeferredReaderSlot = 0 |
static DeferredReaderSlot | deferredReaders [kMaxDeferredReaders *kDeferredSeparationFactor] = {} |
Friends | |
void | acquireRead (SharedMutexImpl &lock) |
void | acquireReadWrite (SharedMutexImpl &lock) |
void | releaseRead (SharedMutexImpl &lock) |
void | releaseReadWrite (SharedMutexImpl &lock) |
bool | acquireRead (SharedMutexImpl &lock, unsigned int ms) |
bool | acquireReadWrite (SharedMutexImpl &lock, unsigned int ms) |
Definition at line 273 of file SharedMutex.h.
typedef Atom<uintptr_t> folly::SharedMutexImpl< ReaderPriority, Tag_, Atom, BlockImmediately, AnnotateForThreadSanitizer >::DeferredReaderSlot |
Definition at line 892 of file SharedMutex.h.
|
private |
Definition at line 572 of file SharedMutex.h.
typedef Tag_ folly::SharedMutexImpl< ReaderPriority, Tag_, Atom, BlockImmediately, AnnotateForThreadSanitizer >::Tag |
Definition at line 277 of file SharedMutex.h.
typedef SharedMutexToken folly::SharedMutexImpl< ReaderPriority, Tag_, Atom, BlockImmediately, AnnotateForThreadSanitizer >::Token |
Definition at line 279 of file SharedMutex.h.
|
inlinenoexcept |
Definition at line 285 of file SharedMutex.h.
|
delete |
|
delete |
|
inline |
Definition at line 300 of file SharedMutex.h.
|
inlineprivate |
Definition at line 693 of file SharedMutex.h.
|
inlineprivate |
Definition at line 686 of file SharedMutex.h.
|
inlineprivate |
Definition at line 672 of file SharedMutex.h.
|
inlineprivate |
Definition at line 707 of file SharedMutex.h.
|
inlineprivate |
Definition at line 700 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1147 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1167 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1255 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1126 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1043 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1122 of file SharedMutex.h.
|
inline |
Definition at line 325 of file SharedMutex.h.
Referenced by folly::ThreadLocalPtr< T, Tag, AccessMode >::Accessor::Accessor(), BENCHMARK(), and TEST().
|
inline |
|
inline |
Definition at line 373 of file SharedMutex.h.
|
inline |
Definition at line 490 of file SharedMutex.h.
|
inlineprivate |
Definition at line 901 of file SharedMutex.h.
|
inlineprivate |
Definition at line 913 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1238 of file SharedMutex.h.
|
private |
Definition at line 1604 of file SharedMutex.h.
References i, folly::SharedMutexToken::slot_, folly::SharedMutexToken::type_, uint16_t, uint32_t, and UNLIKELY.
|
inlineprivate |
Definition at line 1291 of file SharedMutex.h.
|
delete |
|
delete |
|
inlineprivate |
Definition at line 1138 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1130 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1134 of file SharedMutex.h.
|
inline |
Definition at line 331 of file SharedMutex.h.
|
inline |
Definition at line 339 of file SharedMutex.h.
|
inline |
|
inline |
Definition at line 386 of file SharedMutex.h.
|
inline |
Definition at line 394 of file SharedMutex.h.
|
inline |
Definition at line 402 of file SharedMutex.h.
|
inline |
Definition at line 412 of file SharedMutex.h.
|
inline |
Definition at line 421 of file SharedMutex.h.
|
inline |
Definition at line 347 of file SharedMutex.h.
|
inline |
|
inline |
Definition at line 505 of file SharedMutex.h.
|
inline |
Definition at line 514 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1271 of file SharedMutex.h.
|
private |
|
inline |
Definition at line 355 of file SharedMutex.h.
Referenced by BENCHMARK(), folly::ThreadLocalPtr< T, Tag, AccessMode >::Accessor::release(), and TEST().
|
inline |
Definition at line 465 of file SharedMutex.h.
|
inline |
Definition at line 485 of file SharedMutex.h.
|
inline |
Definition at line 550 of file SharedMutex.h.
|
inline |
|
inline |
Definition at line 449 of file SharedMutex.h.
|
inline |
|
inline |
Definition at line 529 of file SharedMutex.h.
|
inline |
Definition at line 537 of file SharedMutex.h.
|
inline |
Definition at line 545 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1277 of file SharedMutex.h.
|
inlineprivate |
Definition at line 981 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1085 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1091 of file SharedMutex.h.
|
inlineprivate |
Definition at line 1002 of file SharedMutex.h.
|
friend |
Definition at line 1489 of file SharedMutex.h.
|
friend |
Definition at line 1501 of file SharedMutex.h.
|
friend |
Definition at line 1492 of file SharedMutex.h.
|
friend |
Definition at line 1504 of file SharedMutex.h.
|
friend |
Definition at line 1495 of file SharedMutex.h.
|
friend |
Definition at line 1498 of file SharedMutex.h.
|
staticprivate |
Definition at line 896 of file SharedMutex.h.
|
staticprivate |
Definition at line 731 of file SharedMutex.h.
|
staticprivate |
Definition at line 755 of file SharedMutex.h.
|
static |
Definition at line 852 of file SharedMutex.h.
|
static |
Definition at line 853 of file SharedMutex.h.
|
staticprivate |
Definition at line 748 of file SharedMutex.h.
|
staticprivate |
Definition at line 726 of file SharedMutex.h.
|
staticprivate |
Definition at line 773 of file SharedMutex.h.
|
staticprivate |
Definition at line 765 of file SharedMutex.h.
|
staticprivate |
Definition at line 725 of file SharedMutex.h.
|
static |
Definition at line 851 of file SharedMutex.h.
|
staticprivate |
Definition at line 828 of file SharedMutex.h.
|
staticprivate |
Definition at line 820 of file SharedMutex.h.
|
staticprivate |
Definition at line 735 of file SharedMutex.h.
|
staticprivate |
Definition at line 813 of file SharedMutex.h.
|
staticprivate |
Definition at line 742 of file SharedMutex.h.
|
static |
Definition at line 275 of file SharedMutex.h.
|
staticprivate |
Definition at line 879 of file SharedMutex.h.
|
staticprivate |
Definition at line 868 of file SharedMutex.h.
|
staticprivate |
Definition at line 805 of file SharedMutex.h.
|
staticprivate |
Definition at line 792 of file SharedMutex.h.
|
staticprivate |
Definition at line 791 of file SharedMutex.h.
|
staticprivate |
Definition at line 790 of file SharedMutex.h.
|
staticprivate |
Definition at line 779 of file SharedMutex.h.
|
staticprivate |
Definition at line 800 of file SharedMutex.h.
|
staticprivate |
Definition at line 796 of file SharedMutex.h.
|
private |
Definition at line 715 of file SharedMutex.h.
|
staticprivate |
Definition at line 885 of file SharedMutex.h.
|
staticprivate |
Definition at line 882 of file SharedMutex.h.