From 93f7677402e8350843566c714d119f1ab669f2a0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 21 Nov 2018 21:47:06 -0500 Subject: common/thread: Make Barrier's 'count' member non-const While admirable as a means to ensure immutability, this has the unfortunate downside of making the class non-movable. std::move cannot actually perform a move operation if the provided operand has const data members (std::move acts as an operation to "slide" resources out of an object instance). Given Barrier contains move-only types such as std::mutex, this can lead to confusing error messages if an object ever contained a Barrier instance and said object was attempted to be moved. --- src/common/thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/thread.h b/src/common/thread.h index 741dce487..2cf74452d 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -73,7 +73,7 @@ public: private: std::condition_variable condvar; std::mutex mutex; - const std::size_t count; + std::size_t count; std::size_t waiting = 0; std::size_t generation = 0; // Incremented once each time the barrier is used }; -- cgit v1.2.3