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

Method acquireRead

src/readwritelock.h:15–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 readWriteLock(const char *name) : m_readLock(name), m_writeLock(name) {}
14
15 void acquireRead() {
16 std::unique_lock<fastlock> rm(m_readLock, std::defer_lock);
17 if (m_multi) {
18 rm.lock();
19 while (m_writeCount > 0 || m_writeWaiting)
20 m_cv.wait(rm);
21 }
22 m_readCount++;
23 }
24
25 bool tryAcquireRead() {
26 std::unique_lock<fastlock> rm(m_readLock, std::defer_lock);

Callers 6

aeProcessCmdFunction · 0.80
processTimeEventsFunction · 0.80
aeProcessEventsFunction · 0.80
aeThreadOnlineFunction · 0.80
aeAcquireLockFunction · 0.80
moduleAcquireGILFunction · 0.80

Calls 2

lockMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected