OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // A condition variable class (to be used with |mojo::system::Mutex|). | 5 // A condition variable class (to be used with |mojo::util::Mutex|). |
6 | 6 |
7 #ifndef MOJO_EDK_SYSTEM_COND_VAR_H_ | 7 #ifndef MOJO_EDK_UTIL_COND_VAR_H_ |
8 #define MOJO_EDK_SYSTEM_COND_VAR_H_ | 8 #define MOJO_EDK_UTIL_COND_VAR_H_ |
9 | 9 |
10 #include <pthread.h> | 10 #include <pthread.h> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 | 12 |
13 #include "mojo/edk/system/thread_annotations.h" | 13 #include "mojo/edk/util/thread_annotations.h" |
14 #include "mojo/public/cpp/system/macros.h" | 14 #include "mojo/public/cpp/system/macros.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace system { | 17 namespace util { |
18 | 18 |
19 class Mutex; | 19 class Mutex; |
20 | 20 |
21 class CondVar { | 21 class CondVar { |
22 public: | 22 public: |
23 CondVar(); | 23 CondVar(); |
24 ~CondVar(); | 24 ~CondVar(); |
25 | 25 |
26 // Atomically releases |*mutex| (which must be held) and blocks on this | 26 // Atomically releases |*mutex| (which must be held) and blocks on this |
27 // condition variable, unlocking and reacquiring |*mutex| when: | 27 // condition variable, unlocking and reacquiring |*mutex| when: |
(...skipping 25 matching lines...) Expand all Loading... |
53 | 53 |
54 // Signals this condition variable, waking all waiting threads. | 54 // Signals this condition variable, waking all waiting threads. |
55 void SignalAll(); | 55 void SignalAll(); |
56 | 56 |
57 private: | 57 private: |
58 pthread_cond_t impl_; | 58 pthread_cond_t impl_; |
59 | 59 |
60 MOJO_DISALLOW_COPY_AND_ASSIGN(CondVar); | 60 MOJO_DISALLOW_COPY_AND_ASSIGN(CondVar); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace system | 63 } // namespace util |
64 } // namespace mojo | 64 } // namespace mojo |
65 | 65 |
66 #endif // MOJO_EDK_SYSTEM_COND_VAR_H_ | 66 #endif // MOJO_EDK_UTIL_COND_VAR_H_ |
OLD | NEW |