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

Method tryAcquireRead

src/readwritelock.h:25–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 }
24
25 bool tryAcquireRead() {
26 std::unique_lock<fastlock> rm(m_readLock, std::defer_lock);
27 if (m_multi) {
28 if (!rm.try_lock())
29 return false;
30 if (m_writeCount > 0 || m_writeWaiting)
31 return false;
32 }
33 m_readCount++;
34 return true;
35 }
36
37 void acquireWrite(bool exclusive = true) {
38 std::unique_lock<fastlock> rm(m_readLock, std::defer_lock);

Callers 1

moduleTryAcquireGILFunction · 0.80

Calls 1

try_lockMethod · 0.45

Tested by

no test coverage detected