MCPcopy Create free account
hub / github.com/Snapchat/Valdi / toValdiLock

Method toValdiLock

valdi_core/src/valdi_core/cpp/Utils/Mutex.cpp:107–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107std::unique_lock<std::mutex> ConditionVariable::toStdLock(std::unique_lock<Mutex>& lock) {
108 if (lock.owns_lock()) {
109 return std::unique_lock<std::mutex>(lock.release()->_innerMutex, std::adopt_lock_t());
110 } else {
111 return std::unique_lock<std::mutex>(lock.release()->_innerMutex, std::defer_lock_t());
112 }
113}
114
115std::unique_lock<Mutex> ConditionVariable::toValdiLock(std::unique_lock<std::mutex>& lock, Mutex* mutex) {
116 if (lock.owns_lock()) {
117 lock.release();
118 mutex->onLockAcquired();
119 return std::unique_lock<Mutex>(*mutex, std::adopt_lock_t());

Callers

nothing calls this directly

Calls 2

onLockAcquiredMethod · 0.80
releaseMethod · 0.45

Tested by

no test coverage detected