| 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 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include "base/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #if defined(OS_POSIX) | 15 #if defined(OS_POSIX) |
| 16 #include <list> | 16 #include <list> |
| 17 #include <utility> | 17 #include <utility> |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 | 23 |
| 24 // This replaces INFINITE from Win32 | |
| 25 static const int kNoTimeout = -1; | |
| 26 | |
| 27 class TimeDelta; | 24 class TimeDelta; |
| 28 | 25 |
| 29 // A WaitableEvent can be a useful thread synchronization tool when you want to | 26 // A WaitableEvent can be a useful thread synchronization tool when you want to |
| 30 // allow one thread to wait for another thread to finish some work. For | 27 // allow one thread to wait for another thread to finish some work. For |
| 31 // non-Windows systems, this can only be used from within a single address | 28 // non-Windows systems, this can only be used from within a single address |
| 32 // space. | 29 // space. |
| 33 // | 30 // |
| 34 // Use a WaitableEvent when you would otherwise use a Lock+ConditionVariable to | 31 // 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 | 32 // 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 | 33 // WaitableEvent in conjunction with a Lock to wait for a more complex state |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 177 |
| 181 scoped_refptr<WaitableEventKernel> kernel_; | 178 scoped_refptr<WaitableEventKernel> kernel_; |
| 182 #endif | 179 #endif |
| 183 | 180 |
| 184 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); | 181 DISALLOW_COPY_AND_ASSIGN(WaitableEvent); |
| 185 }; | 182 }; |
| 186 | 183 |
| 187 } // namespace base | 184 } // namespace base |
| 188 | 185 |
| 189 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ | 186 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ |
| OLD | NEW |