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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // consumer must call the Reset method. If this parameter is false, then the | 49 // consumer must call the Reset method. If this parameter is false, then the |
50 // system automatically resets the event state to non-signaled after a single | 50 // system automatically resets the event state to non-signaled after a single |
51 // waiting thread has been released. | 51 // waiting thread has been released. |
52 WaitableEvent(bool manual_reset, bool initially_signaled); | 52 WaitableEvent(bool manual_reset, bool initially_signaled); |
53 | 53 |
54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
55 // Create a WaitableEvent from an Event HANDLE which has already been | 55 // Create a WaitableEvent from an Event HANDLE which has already been |
56 // created. This objects takes ownership of the HANDLE and will close it when | 56 // created. This objects takes ownership of the HANDLE and will close it when |
57 // deleted. | 57 // deleted. |
58 explicit WaitableEvent(HANDLE event_handle); | 58 explicit WaitableEvent(HANDLE event_handle); |
| 59 |
| 60 // Releases ownership of the handle from this object. |
| 61 HANDLE Release(); |
59 #endif | 62 #endif |
60 | 63 |
61 // WARNING: Destroying a WaitableEvent while threads are waiting on it is not | 64 // WARNING: Destroying a WaitableEvent while threads are waiting on it is not |
62 // supported. Doing so will cause crashes or other instability. | 65 // supported. Doing so will cause crashes or other instability. |
63 ~WaitableEvent(); | 66 ~WaitableEvent(); |
64 | 67 |
65 // Put the event in the un-signaled state. | 68 // Put the event in the un-signaled state. |
66 void Reset(); | 69 void Reset(); |
67 | 70 |
68 // Put the event in the signaled state. Causing any thread blocked on Wait | 71 // Put the event in the signaled state. Causing any thread blocked on Wait |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 const bool manual_reset_; | 150 const bool manual_reset_; |
148 std::list<Waiter*> waiters_; | 151 std::list<Waiter*> waiters_; |
149 #endif | 152 #endif |
150 | 153 |
151 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 154 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
152 }; | 155 }; |
153 | 156 |
154 } // namespace base | 157 } // namespace base |
155 | 158 |
156 #endif // BASE_WAITABLE_EVENT_H_ | 159 #endif // BASE_WAITABLE_EVENT_H_ |
OLD | NEW |