Common/Barrier: add method to get current generation

This commit is contained in:
Weiyi Wang 2018-12-19 19:44:11 -05:00
parent 969dc3b46f
commit fbad420240

View File

@ -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