diff options
| -rw-r--r-- | src/common/thread.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/common/thread.h b/src/common/thread.h index 816183bc8..741dce487 100644 --- a/src/common/thread.h +++ b/src/common/thread.h | |||
| @@ -15,8 +15,6 @@ namespace Common { | |||
| 15 | 15 | ||
| 16 | class Event { | 16 | class Event { |
| 17 | public: | 17 | public: |
| 18 | Event() : is_set(false) {} | ||
| 19 | |||
| 20 | void Set() { | 18 | void Set() { |
| 21 | std::lock_guard<std::mutex> lk(mutex); | 19 | std::lock_guard<std::mutex> lk(mutex); |
| 22 | if (!is_set) { | 20 | if (!is_set) { |
| @@ -48,14 +46,14 @@ public: | |||
| 48 | } | 46 | } |
| 49 | 47 | ||
| 50 | private: | 48 | private: |
| 51 | bool is_set; | 49 | bool is_set = false; |
| 52 | std::condition_variable condvar; | 50 | std::condition_variable condvar; |
| 53 | std::mutex mutex; | 51 | std::mutex mutex; |
| 54 | }; | 52 | }; |
| 55 | 53 | ||
| 56 | class Barrier { | 54 | class Barrier { |
| 57 | public: | 55 | public: |
| 58 | explicit Barrier(std::size_t count_) : count(count_), waiting(0), generation(0) {} | 56 | explicit Barrier(std::size_t count_) : count(count_) {} |
| 59 | 57 | ||
| 60 | /// Blocks until all "count" threads have called Sync() | 58 | /// Blocks until all "count" threads have called Sync() |
| 61 | void Sync() { | 59 | void Sync() { |
| @@ -76,8 +74,8 @@ private: | |||
| 76 | std::condition_variable condvar; | 74 | std::condition_variable condvar; |
| 77 | std::mutex mutex; | 75 | std::mutex mutex; |
| 78 | const std::size_t count; | 76 | const std::size_t count; |
| 79 | std::size_t waiting; | 77 | std::size_t waiting = 0; |
| 80 | std::size_t generation; // Incremented once each time the barrier is used | 78 | std::size_t generation = 0; // Incremented once each time the barrier is used |
| 81 | }; | 79 | }; |
| 82 | 80 | ||
| 83 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask); | 81 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask); |