From fbad420240c2247e0ebf792404876c17a7b88c2b Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Wed, 19 Dec 2018 19:44:11 -0500 Subject: [PATCH] Common/Barrier: add method to get current generation --- src/common/thread.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/thread.h b/src/common/thread.h index e84db99a0..38532a190 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -79,9 +79,14 @@ public: } } + std::size_t Generation() const { + std::unique_lock lk(mutex); + return generation; + } + private: std::condition_variable condvar; - std::mutex mutex; + mutable std::mutex mutex; std::size_t count; std::size_t waiting = 0; std::size_t generation = 0; // Incremented once each time the barrier is used