MCPcopy Create free account
hub / github.com/Compaile/ctrack / wait

Method wait

test/test_helpers.hpp:101–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 explicit ThreadBarrier(size_t count) : threshold(count), count(count), generation(0) {}
100
101 void wait() {
102 std::unique_lock<std::mutex> lock(mutex);
103 auto gen = generation;
104
105 if (--count == 0) {
106 generation++;
107 count = threshold;
108 cond.notify_all();
109 } else {
110 cond.wait(lock, [this, gen] { return gen != generation; });
111 }
112 }
113
114private:
115 std::mutex mutex;

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected