OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_WAITABLE_EVENT_H_ | 5 #ifndef BASE_WAITABLE_EVENT_H_ |
6 #define BASE_WAITABLE_EVENT_H_ | 6 #define BASE_WAITABLE_EVENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 bool SignalOne(); | 129 bool SignalOne(); |
130 void Enqueue(Waiter* waiter); | 130 void Enqueue(Waiter* waiter); |
131 bool Dequeue(Waiter* waiter, void* tag); | 131 bool Dequeue(Waiter* waiter, void* tag); |
132 | 132 |
133 // When dealing with arrays of WaitableEvent*, we want to sort by the address | 133 // When dealing with arrays of WaitableEvent*, we want to sort by the address |
134 // of the WaitableEvent in order to have a globally consistent locking order. | 134 // of the WaitableEvent in order to have a globally consistent locking order. |
135 // In that case we keep them, in sorted order, in an array of pairs where the | 135 // In that case we keep them, in sorted order, in an array of pairs where the |
136 // second element is the index of the WaitableEvent in the original, | 136 // second element is the index of the WaitableEvent in the original, |
137 // unsorted, array. | 137 // unsorted, array. |
138 typedef std::pair<WaitableEvent*, size_t> WaiterAndIndex; | 138 typedef std::pair<WaitableEvent*, size_t> WaiterAndIndex; |
139 static unsigned EnqueueMany(WaiterAndIndex* waitables, | 139 static size_t EnqueueMany(WaiterAndIndex* waitables, |
140 size_t count, Waiter* waiter); | 140 size_t count, Waiter* waiter); |
141 | 141 |
142 Lock lock_; | 142 Lock lock_; |
143 bool signaled_; | 143 bool signaled_; |
144 const bool manual_reset_; | 144 const bool manual_reset_; |
145 std::list<Waiter*> waiters_; | 145 std::list<Waiter*> waiters_; |
146 #endif | 146 #endif |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 148 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace base | 151 } // namespace base |
152 | 152 |
153 #endif // BASE_WAITABLE_EVENT_H_ | 153 #endif // BASE_WAITABLE_EVENT_H_ |
OLD | NEW |