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 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace base { | 37 namespace base { |
38 | 38 |
39 // ----------------------------------------------------------------------------- | 39 // ----------------------------------------------------------------------------- |
40 // This is just an abstract base class for waking the two types of waiters | 40 // This is just an abstract base class for waking the two types of waiters |
41 // ----------------------------------------------------------------------------- | 41 // ----------------------------------------------------------------------------- |
42 WaitableEvent::WaitableEvent(bool manual_reset, bool initially_signaled) | 42 WaitableEvent::WaitableEvent(bool manual_reset, bool initially_signaled) |
43 : kernel_(new WaitableEventKernel(manual_reset, initially_signaled)) { | 43 : kernel_(new WaitableEventKernel(manual_reset, initially_signaled)) { |
44 } | 44 } |
45 | 45 |
| 46 WaitableEvent::WaitableEvent(ResetPolicy reset_policy, |
| 47 InitialState initial_state) |
| 48 : WaitableEvent(reset_policy == ResetPolicy::MANUAL, |
| 49 initial_state == InitialState::SIGNALED) {} |
| 50 |
46 WaitableEvent::~WaitableEvent() { | 51 WaitableEvent::~WaitableEvent() { |
47 } | 52 } |
48 | 53 |
49 void WaitableEvent::Reset() { | 54 void WaitableEvent::Reset() { |
50 base::AutoLock locked(kernel_->lock_); | 55 base::AutoLock locked(kernel_->lock_); |
51 kernel_->signaled_ = false; | 56 kernel_->signaled_ = false; |
52 } | 57 } |
53 | 58 |
54 void WaitableEvent::Signal() { | 59 void WaitableEvent::Signal() { |
55 base::AutoLock locked(kernel_->lock_); | 60 base::AutoLock locked(kernel_->lock_); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 return true; | 413 return true; |
409 } | 414 } |
410 } | 415 } |
411 | 416 |
412 return false; | 417 return false; |
413 } | 418 } |
414 | 419 |
415 // ----------------------------------------------------------------------------- | 420 // ----------------------------------------------------------------------------- |
416 | 421 |
417 } // namespace base | 422 } // namespace base |
OLD | NEW |