Common/Barrier: add method to get current generation
This commit is contained in:
parent
969dc3b46f
commit
fbad420240
1 changed files with 6 additions and 1 deletions
|
@ -79,9 +79,14 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t Generation() const {
|
||||||
|
std::unique_lock<std::mutex> lk(mutex);
|
||||||
|
return generation;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::condition_variable condvar;
|
std::condition_variable condvar;
|
||||||
std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
std::size_t count;
|
std::size_t count;
|
||||||
std::size_t waiting = 0;
|
std::size_t waiting = 0;
|
||||||
std::size_t generation = 0; // Incremented once each time the barrier is used
|
std::size_t generation = 0; // Incremented once each time the barrier is used
|
||||||
|
|
Loading…
Reference in a new issue