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 "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // If manual_reset is true, then to set the event state to non-signaled, a | 46 // If manual_reset is true, then to set the event state to non-signaled, a |
47 // consumer must call the Reset method. If this parameter is false, then the | 47 // consumer must call the Reset method. If this parameter is false, then the |
48 // system automatically resets the event state to non-signaled after a single | 48 // system automatically resets the event state to non-signaled after a single |
49 // waiting thread has been released. | 49 // waiting thread has been released. |
50 WaitableEvent(bool manual_reset, bool initially_signaled); | 50 WaitableEvent(bool manual_reset, bool initially_signaled); |
51 | 51 |
52 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
53 // Create a WaitableEvent from an Event HANDLE which has already been | 53 // Create a WaitableEvent from an Event HANDLE which has already been |
54 // created. This objects takes ownership of the HANDLE and will close it when | 54 // created. This objects takes ownership of the HANDLE and will close it when |
55 // deleted. | 55 // deleted. |
56 // TODO(rvargas): Pass ScopedHandle instead (and on Release). | 56 explicit WaitableEvent(win::ScopedHandle event_handle); |
57 explicit WaitableEvent(HANDLE event_handle); | |
58 | |
59 // Releases ownership of the handle from this object. | |
60 HANDLE Release(); | |
61 #endif | 57 #endif |
62 | 58 |
63 ~WaitableEvent(); | 59 ~WaitableEvent(); |
64 | 60 |
65 // Put the event in the un-signaled state. | 61 // Put the event in the un-signaled state. |
66 void Reset(); | 62 void Reset(); |
67 | 63 |
68 // Put the event in the signaled state. Causing any thread blocked on Wait | 64 // Put the event in the signaled state. Causing any thread blocked on Wait |
69 // to be woken up. | 65 // to be woken up. |
70 void Signal(); | 66 void Signal(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 180 |
185 scoped_refptr<WaitableEventKernel> kernel_; | 181 scoped_refptr<WaitableEventKernel> kernel_; |
186 #endif | 182 #endif |
187 | 183 |
188 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 184 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
189 }; | 185 }; |
190 | 186 |
191 } // namespace base | 187 } // namespace base |
192 | 188 |
193 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ | 189 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ |
OLD | NEW |