OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "third_party/webrtc_overrides/webrtc/rtc_base/event.h" |
| 6 |
| 7 #include "base/time/time.h" |
| 8 |
| 9 namespace rtc { |
| 10 |
| 11 using base::WaitableEvent; |
| 12 |
| 13 Event::Event(bool manual_reset, bool initially_signaled) |
| 14 : event_(manual_reset ? WaitableEvent::ResetPolicy::MANUAL |
| 15 : WaitableEvent::ResetPolicy::AUTOMATIC, |
| 16 initially_signaled ? WaitableEvent::InitialState::SIGNALED |
| 17 : WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 18 |
| 19 Event::~Event() {} |
| 20 |
| 21 void Event::Set() { |
| 22 event_.Signal(); |
| 23 } |
| 24 |
| 25 void Event::Reset() { |
| 26 event_.Reset(); |
| 27 } |
| 28 |
| 29 bool Event::Wait(int milliseconds) { |
| 30 if (milliseconds == kForever) { |
| 31 event_.Wait(); |
| 32 return true; |
| 33 } |
| 34 |
| 35 return event_.TimedWait(base::TimeDelta::FromMilliseconds(milliseconds)); |
| 36 } |
| 37 |
| 38 } // namespace rtc |
OLD | NEW |