summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-11-21 21:47:06 -0500
committerGravatar Lioncash2018-11-21 21:47:08 -0500
commit93f7677402e8350843566c714d119f1ab669f2a0 (patch)
treea2a89ba90622dabbb0d5b6466f986dbb72f05f66 /src
parentcommon/thread: Initialize class member variables where applicable (diff)
downloadyuzu-93f7677402e8350843566c714d119f1ab669f2a0.tar.gz
yuzu-93f7677402e8350843566c714d119f1ab669f2a0.tar.xz
yuzu-93f7677402e8350843566c714d119f1ab669f2a0.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/common/thread.h2
1 files changed, 1 insertions, 1 deletions
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:
73private: 73private:
74 std::condition_variable condvar; 74 std::condition_variable condvar;
75 std::mutex mutex; 75 std::mutex mutex;
76 const std::size_t count; 76 std::size_t count;
77 std::size_t waiting = 0; 77 std::size_t waiting = 0;
78 std::size_t generation = 0; // Incremented once each time the barrier is used 78 std::size_t generation = 0; // Incremented once each time the barrier is used
79}; 79};