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

Method blockingWait

valdi/src/valdi/runtime/Utils/AsyncGroup.cpp:67–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void AsyncGroup::blockingWait() {
68 std::unique_lock<Mutex> guard(_mutex);
69 if (_enterCount == 0) {
70 return;
71 }
72
73 auto cond = Valdi::makeShared<ConditionVariable>();
74
75 while (_enterCount != 0) {
76 auto functionId = lockFreeEnqueueFunction([cond]() { cond->notifyAll(); });
77
78 cond->wait(guard);
79
80 lockFreeRemoveFunction(functionId);
81 }
82}
83
84bool AsyncGroup::blockingWaitWithTimeout(const std::chrono::steady_clock::duration& maxTime) {
85 std::unique_lock<Mutex> guard(_mutex);

Callers 6

TEST_PFunction · 0.80
TEST_PMethod · 0.80
TESTFunction · 0.80
pauseWorkerQueueMethod · 0.80
JavaScriptRuntimeMethod · 0.80

Calls 2

notifyAllMethod · 0.80
waitMethod · 0.45

Tested by 4

TEST_PFunction · 0.64
TEST_PMethod · 0.64
TESTFunction · 0.64
pauseWorkerQueueMethod · 0.64