| OLD | NEW |
| 1 // Copyright (c) 2009 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) |
| 11 #include <windows.h> | 11 #include <windows.h> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Because of this, a Waiter may "reject" a wake by returning false. In | 114 // Because of this, a Waiter may "reject" a wake by returning false. In |
| 115 // this case, the auto-reset WaitableEvent shouldn't act as if anything has | 115 // this case, the auto-reset WaitableEvent shouldn't act as if anything has |
| 116 // been notified. | 116 // been notified. |
| 117 virtual bool Fire(WaitableEvent* signaling_event) = 0; | 117 virtual bool Fire(WaitableEvent* signaling_event) = 0; |
| 118 | 118 |
| 119 // Waiters may implement this in order to provide an extra condition for | 119 // Waiters may implement this in order to provide an extra condition for |
| 120 // two Waiters to be considered equal. In WaitableEvent::Dequeue, if the | 120 // two Waiters to be considered equal. In WaitableEvent::Dequeue, if the |
| 121 // pointers match then this function is called as a final check. See the | 121 // pointers match then this function is called as a final check. See the |
| 122 // comments in ~Handle for why. | 122 // comments in ~Handle for why. |
| 123 virtual bool Compare(void* tag) = 0; | 123 virtual bool Compare(void* tag) = 0; |
| 124 | |
| 125 protected: | |
| 126 ~Waiter() {} | |
| 127 }; | 124 }; |
| 128 | 125 |
| 129 private: | 126 private: |
| 130 friend class WaitableEventWatcher; | 127 friend class WaitableEventWatcher; |
| 131 | 128 |
| 132 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
| 133 HANDLE handle_; | 130 HANDLE handle_; |
| 134 #else | 131 #else |
| 135 // On Windows, one can close a HANDLE which is currently being waited on. The | 132 // On Windows, one can close a HANDLE which is currently being waited on. The |
| 136 // MSDN documentation says that the resulting behaviour is 'undefined', but | 133 // MSDN documentation says that the resulting behaviour is 'undefined', but |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 static size_t EnqueueMany(WaiterAndIndex* waitables, | 168 static size_t EnqueueMany(WaiterAndIndex* waitables, |
| 172 size_t count, Waiter* waiter); | 169 size_t count, Waiter* waiter); |
| 173 #endif | 170 #endif |
| 174 | 171 |
| 175 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 172 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
| 176 }; | 173 }; |
| 177 | 174 |
| 178 } // namespace base | 175 } // namespace base |
| 179 | 176 |
| 180 #endif // BASE_WAITABLE_EVENT_H_ | 177 #endif // BASE_WAITABLE_EVENT_H_ |
| OLD | NEW |