Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: base/synchronization/waitable_event.h

Issue 6725001: Base: First pass at having base.dll: definition of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include "base/base_api.h"
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 11
11 #if defined(OS_WIN) 12 #if defined(OS_WIN)
12 #include <windows.h> 13 #include <windows.h>
13 #endif 14 #endif
14 15
15 #if defined(OS_POSIX) 16 #if defined(OS_POSIX)
16 #include <list> 17 #include <list>
17 #include <utility> 18 #include <utility>
18 #include "base/ref_counted.h" 19 #include "base/ref_counted.h"
(...skipping 15 matching lines...) Expand all
34 // Use a WaitableEvent when you would otherwise use a Lock+ConditionVariable to 35 // Use a WaitableEvent when you would otherwise use a Lock+ConditionVariable to
35 // protect a simple boolean value. However, if you find yourself using a 36 // protect a simple boolean value. However, if you find yourself using a
36 // WaitableEvent in conjunction with a Lock to wait for a more complex state 37 // WaitableEvent in conjunction with a Lock to wait for a more complex state
37 // change (e.g., for an item to be added to a queue), then you should probably 38 // change (e.g., for an item to be added to a queue), then you should probably
38 // be using a ConditionVariable instead of a WaitableEvent. 39 // be using a ConditionVariable instead of a WaitableEvent.
39 // 40 //
40 // NOTE: On Windows, this class provides a subset of the functionality afforded 41 // NOTE: On Windows, this class provides a subset of the functionality afforded
41 // by a Windows event object. This is intentional. If you are writing Windows 42 // by a Windows event object. This is intentional. If you are writing Windows
42 // specific code and you need other features of a Windows event, then you might 43 // specific code and you need other features of a Windows event, then you might
43 // be better off just using an Windows event directly. 44 // be better off just using an Windows event directly.
44 class WaitableEvent { 45 class BASE_API WaitableEvent {
45 public: 46 public:
46 // If manual_reset is true, then to set the event state to non-signaled, a 47 // 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 48 // 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 49 // system automatically resets the event state to non-signaled after a single
49 // waiting thread has been released. 50 // waiting thread has been released.
50 WaitableEvent(bool manual_reset, bool initially_signaled); 51 WaitableEvent(bool manual_reset, bool initially_signaled);
51 52
52 #if defined(OS_WIN) 53 #if defined(OS_WIN)
53 // Create a WaitableEvent from an Event HANDLE which has already been 54 // 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 55 // created. This objects takes ownership of the HANDLE and will close it when
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 scoped_refptr<WaitableEventKernel> kernel_; 173 scoped_refptr<WaitableEventKernel> kernel_;
173 #endif 174 #endif
174 175
175 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); 176 DISALLOW_COPY_AND_ASSIGN(WaitableEvent);
176 }; 177 };
177 178
178 } // namespace base 179 } // namespace base
179 180
180 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ 181 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698