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. | |
118 static size_t WaitMany(WaitableEvent** waitables, size_t count); | 115 static size_t WaitMany(WaitableEvent** waitables, size_t count); |
119 | 116 |
120 // For asynchronous waiting, see WaitableEventWatcher | 117 // For asynchronous waiting, see WaitableEventWatcher |
121 | 118 |
122 // This is a private helper class. It's here because it's used by friends of | 119 // This is a private helper class. It's here because it's used by friends of |
123 // this class (such as WaitableEventWatcher) to be able to enqueue elements | 120 // this class (such as WaitableEventWatcher) to be able to enqueue elements |
124 // of the wait-list | 121 // of the wait-list |
125 class Waiter { | 122 class Waiter { |
126 public: | 123 public: |
127 // Signal the waiter to wake up. | 124 // Signal the waiter to wake up. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 193 |
197 scoped_refptr<WaitableEventKernel> kernel_; | 194 scoped_refptr<WaitableEventKernel> kernel_; |
198 #endif | 195 #endif |
199 | 196 |
200 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 197 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
201 }; | 198 }; |
202 | 199 |
203 } // namespace base | 200 } // namespace base |
204 | 201 |
205 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ | 202 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ |
OLD | NEW |