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 #include "mojo/edk/system/waitable_event.h" | 5 #include "mojo/edk/system/waitable_event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 | 9 |
| 10 using mojo::util::CondVar; |
| 11 using mojo::util::Mutex; |
| 12 using mojo::util::MutexLocker; |
| 13 |
10 namespace mojo { | 14 namespace mojo { |
11 namespace system { | 15 namespace system { |
12 | 16 |
13 namespace { | 17 namespace { |
14 | 18 |
15 // Waits with a timeout on |condition()|. Returns true on timeout, or false if | 19 // Waits with a timeout on |condition()|. Returns true on timeout, or false if |
16 // |condition()| ever returns true. |condition()| should have no side effects | 20 // |condition()| ever returns true. |condition()| should have no side effects |
17 // (and will always be called with |*mutex| held). | 21 // (and will always be called with |*mutex| held). |
18 template <typename ConditionFn> | 22 template <typename ConditionFn> |
19 bool WaitWithTimeoutImpl(Mutex* mutex, | 23 bool WaitWithTimeoutImpl(Mutex* mutex, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return rv; | 159 return rv; |
156 } | 160 } |
157 | 161 |
158 bool ManualResetWaitableEvent::IsSignaledForTest() { | 162 bool ManualResetWaitableEvent::IsSignaledForTest() { |
159 MutexLocker locker(&mutex_); | 163 MutexLocker locker(&mutex_); |
160 return signaled_; | 164 return signaled_; |
161 } | 165 } |
162 | 166 |
163 } // namespace system | 167 } // namespace system |
164 } // namespace mojo | 168 } // namespace mojo |
OLD | NEW |