summaryrefslogtreecommitdiff
path: root/src/common/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/thread.h')
-rw-r--r--src/common/thread.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/thread.h b/src/common/thread.h
index c5fc3533d..0cfd98be6 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -15,7 +15,7 @@ namespace Common {
15class Event { 15class Event {
16public: 16public:
17 void Set() { 17 void Set() {
18 std::lock_guard<std::mutex> lk(mutex); 18 std::lock_guard lk{mutex};
19 if (!is_set) { 19 if (!is_set) {
20 is_set = true; 20 is_set = true;
21 condvar.notify_one(); 21 condvar.notify_one();
@@ -23,14 +23,14 @@ public:
23 } 23 }
24 24
25 void Wait() { 25 void Wait() {
26 std::unique_lock<std::mutex> lk(mutex); 26 std::unique_lock lk{mutex};
27 condvar.wait(lk, [&] { return is_set; }); 27 condvar.wait(lk, [&] { return is_set; });
28 is_set = false; 28 is_set = false;
29 } 29 }
30 30
31 template <class Clock, class Duration> 31 template <class Clock, class Duration>
32 bool WaitUntil(const std::chrono::time_point<Clock, Duration>& time) { 32 bool WaitUntil(const std::chrono::time_point<Clock, Duration>& time) {
33 std::unique_lock<std::mutex> lk(mutex); 33 std::unique_lock lk{mutex};
34 if (!condvar.wait_until(lk, time, [this] { return is_set; })) 34 if (!condvar.wait_until(lk, time, [this] { return is_set; }))
35 return false; 35 return false;
36 is_set = false; 36 is_set = false;
@@ -38,7 +38,7 @@ public:
38 } 38 }
39 39
40 void Reset() { 40 void Reset() {
41 std::unique_lock<std::mutex> lk(mutex); 41 std::unique_lock lk{mutex};
42 // no other action required, since wait loops on the predicate and any lingering signal will 42 // no other action required, since wait loops on the predicate and any lingering signal will
43 // get cleared on the first iteration 43 // get cleared on the first iteration
44 is_set = false; 44 is_set = false;
@@ -56,7 +56,7 @@ public:
56 56
57 /// Blocks until all "count" threads have called Sync() 57 /// Blocks until all "count" threads have called Sync()
58 void Sync() { 58 void Sync() {
59 std::unique_lock<std::mutex> lk(mutex); 59 std::unique_lock lk{mutex};
60 const std::size_t current_generation = generation; 60 const std::size_t current_generation = generation;
61 61
62 if (++waiting == count) { 62 if (++waiting == count) {