OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ | 5 #ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ |
6 #define BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ | 6 #define BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Wait, synchronously, on multiple events. | 106 // Wait, synchronously, on multiple events. |
107 // waitables: an array of WaitableEvent pointers | 107 // waitables: an array of WaitableEvent pointers |
108 // count: the number of elements in @waitables | 108 // count: the number of elements in @waitables |
109 // | 109 // |
110 // returns: the index of a WaitableEvent which has been signaled. | 110 // returns: the index of a WaitableEvent which has been signaled. |
111 // | 111 // |
112 // You MUST NOT delete any of the WaitableEvent objects while this wait is | 112 // You MUST NOT delete any of the WaitableEvent objects while this wait is |
113 // happening, however WaitMany's return "happens after" the |Signal| call | 113 // happening, however WaitMany's return "happens after" the |Signal| call |
114 // that caused it has completed, like |Wait|. | 114 // that caused it has completed, like |Wait|. |
| 115 // |
| 116 // If more than one WaitableEvent is signaled to unblock WaitMany, the lowest |
| 117 // index among them is returned. |
115 static size_t WaitMany(WaitableEvent** waitables, size_t count); | 118 static size_t WaitMany(WaitableEvent** waitables, size_t count); |
116 | 119 |
117 // For asynchronous waiting, see WaitableEventWatcher | 120 // For asynchronous waiting, see WaitableEventWatcher |
118 | 121 |
119 // This is a private helper class. It's here because it's used by friends of | 122 // This is a private helper class. It's here because it's used by friends of |
120 // this class (such as WaitableEventWatcher) to be able to enqueue elements | 123 // this class (such as WaitableEventWatcher) to be able to enqueue elements |
121 // of the wait-list | 124 // of the wait-list |
122 class Waiter { | 125 class Waiter { |
123 public: | 126 public: |
124 // Signal the waiter to wake up. | 127 // Signal the waiter to wake up. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 196 |
194 scoped_refptr<WaitableEventKernel> kernel_; | 197 scoped_refptr<WaitableEventKernel> kernel_; |
195 #endif | 198 #endif |
196 | 199 |
197 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 200 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
198 }; | 201 }; |
199 | 202 |
200 } // namespace base | 203 } // namespace base |
201 | 204 |
202 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ | 205 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ |
OLD | NEW |