MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / fastlock_unlock

Function fastlock_unlock

src/fastlock.cpp:430–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430extern "C" void fastlock_unlock(struct fastlock *lock)
431{
432 --lock->m_depth;
433 if (lock->m_depth == 0)
434 {
435 int pidT;
436 __atomic_load(&lock->m_pidOwner, &pidT, __ATOMIC_RELAXED);
437 serverAssert(pidT >= 0); // unlock after free
438 int t = -1;
439 __atomic_store(&lock->m_pidOwner, &t, __ATOMIC_RELEASE);
440 std::atomic_thread_fence(std::memory_order_acq_rel);
441 ANNOTATE_RWLOCK_RELEASED(lock, true);
442 uint16_t activeNew = __atomic_add_fetch(&lock->m_ticket.m_active, 1, __ATOMIC_RELEASE); // on x86 the atomic is not required here, but ASM handles that case
443#ifdef __linux__
444 unlock_futex(lock, activeNew);
445#else
446 UNUSED(activeNew);
447#endif
448 }
449}
450#endif
451
452#ifdef __linux__

Callers 8

pubsubPublishMessageFunction · 0.85
unlockMethod · 0.85
clientsCronFunction · 0.85
registerwaitMethod · 0.85
clearwaitMethod · 0.85
freeFakeClientFunction · 0.85

Calls 1

unlock_futexFunction · 0.85

Tested by

no test coverage detected