32 uint32_t slotWaitBit = slotHeldBit << 1;
36 if ((oldWord & slotHeldBit) != 0) {
38 if (spins > maxSpins + maxYields) {
42 newWord = oldWord | slotWaitBit;
43 if (newWord != oldWord) {
44 if (!wordPtr->compare_exchange_weak(
47 std::memory_order_relaxed,
48 std::memory_order_relaxed)) {
53 needWaitBit = slotWaitBit;
54 }
else if (spins > maxSpins) {
60 oldWord = wordPtr->load(std::memory_order_relaxed);
64 newWord = oldWord | slotHeldBit | needWaitBit;
65 if (!wordPtr->compare_exchange_weak(
68 std::memory_order_acquire,
69 std::memory_order_relaxed)) {
static constexpr StringPiece retry
Atom< std::uint32_t > Futex
—— Concurrent Priority Queue Implementation ——
FutexResult futexWait(const Futex *futex, uint32_t expected, uint32_t waitMask)
static void lockSlowPath(uint32_t oldWord, detail::Futex<> *wordPtr, uint32_t slotHeldBit, unsigned maxSpins, unsigned maxYields)
void asm_volatile_pause()