MCPcopy Create free account
hub / github.com/VCVRack/Rack / wait

Method wait

src/engine/Engine.cpp:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 }
46
47 void wait() {
48 std::unique_lock<std::mutex> lock(mutex);
49 size_t currentPhase = phase;
50
51 // Check if we're the last thread.
52 if (++count >= threads) {
53 // Advance phase and reset count
54 count = 0;
55 phase++;
56 // Notify all other threads
57 cv.notify_all();
58 return;
59 }
60
61 // Unlock and wait on phase to change
62 cv.wait(lock, [&] {
63 return phase != currentPhase;
64 });
65 }
66};
67
68

Callers 6

runThreadMethod · 0.45
waitMethod · 0.45
Engine_relaunchWorkersFunction · 0.45
Engine_stepFrameFunction · 0.45
runMethod · 0.45
Engine_fallbackRunFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected