MCPcopy Create free account
hub / github.com/Snapchat/Valdi / ~TrackedLock

Method ~TrackedLock

valdi_core/src/valdi_core/cpp/Utils/TrackedLock.cpp:23–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 : _parent(kTopTrackedLock), _mutex(&mutex), _owns(false) {
22 kTopTrackedLock = this;
23
24 // Poll rather than block: std::recursive_mutex has no timed acquire, and swapping the type
25 // would tax every RecursiveMutex user. 1ms granularity is negligible against the input
26 // deadlines this serves.
27 while (!(_owns = mutex.try_lock())) {
28 if (std::chrono::steady_clock::now() >= deadline) {
29 break;
30 }
31 std::this_thread::sleep_for(std::chrono::milliseconds(1));
32 }
33}

Callers

nothing calls this directly

Calls 1

unlockMethod · 0.45

Tested by

no test coverage detected