OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> |
| 6 #include <vector> |
| 7 |
5 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
6 | 9 |
7 #include "base/synchronization/condition_variable.h" | 10 #include "base/synchronization/condition_variable.h" |
8 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
9 #include "base/message_loop.h" | 12 #include "base/logging.h" |
10 | 13 |
11 // ----------------------------------------------------------------------------- | 14 // ----------------------------------------------------------------------------- |
12 // A WaitableEvent on POSIX is implemented as a wait-list. Currently we don't | 15 // A WaitableEvent on POSIX is implemented as a wait-list. Currently we don't |
13 // support cross-process events (where one process can signal an event which | 16 // support cross-process events (where one process can signal an event which |
14 // others are waiting on). Because of this, we can avoid having one thread per | 17 // others are waiting on). Because of this, we can avoid having one thread per |
15 // listener in several cases. | 18 // listener in several cases. |
16 // | 19 // |
17 // The WaitableEvent maintains a list of waiters, protected by a lock. Each | 20 // The WaitableEvent maintains a list of waiters, protected by a lock. Each |
18 // waiter is either an async wait, in which case we have a Task and the | 21 // waiter is either an async wait, in which case we have a Task and the |
19 // MessageLoop to run it on, or a blocking wait, in which case we have the | 22 // MessageLoop to run it on, or a blocking wait, in which case we have the |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 return true; | 396 return true; |
394 } | 397 } |
395 } | 398 } |
396 | 399 |
397 return false; | 400 return false; |
398 } | 401 } |
399 | 402 |
400 // ----------------------------------------------------------------------------- | 403 // ----------------------------------------------------------------------------- |
401 | 404 |
402 } // namespace base | 405 } // namespace base |
OLD | NEW |