Replace some usage of EventWrapper with rtc::Event.

Bug: webrtc:3380
Change-Id: Id33b19bf107273e6f838aa633784db73d02ae2c2
Reviewed-on: https://webrtc-review.googlesource.com/c/107888
Reviewed-by: Henrik Grunell <henrikg@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25407}
This commit is contained in:
Niels Möller
2018-10-29 09:47:51 +01:00
committed by Commit Bot
parent 88d8d7d3f9
commit 2c16cc61c2
10 changed files with 74 additions and 101 deletions

View File

@ -44,7 +44,7 @@ std::unique_ptr<ProcessThread> ProcessThread::Create(const char* thread_name) {
}
ProcessThreadImpl::ProcessThreadImpl(const char* thread_name)
: wake_up_(EventWrapper::Create()),
: wake_up_(/*manual_reset=*/false, /*initially_signaled=*/false),
stop_(false),
thread_name_(thread_name) {}
@ -85,7 +85,7 @@ void ProcessThreadImpl::Stop() {
stop_ = true;
}
wake_up_->Set();
wake_up_.Set();
thread_->Stop();
stop_ = false;
@ -104,7 +104,7 @@ void ProcessThreadImpl::WakeUp(Module* module) {
m.next_callback = kCallProcessImmediately;
}
}
wake_up_->Set();
wake_up_.Set();
}
void ProcessThreadImpl::PostTask(std::unique_ptr<rtc::QueuedTask> task) {
@ -113,7 +113,7 @@ void ProcessThreadImpl::PostTask(std::unique_ptr<rtc::QueuedTask> task) {
rtc::CritScope lock(&lock_);
queue_.push(task.release());
}
wake_up_->Set();
wake_up_.Set();
}
void ProcessThreadImpl::RegisterModule(Module* module,
@ -147,7 +147,7 @@ void ProcessThreadImpl::RegisterModule(Module* module,
// Wake the thread calling ProcessThreadImpl::Process() to update the
// waiting time. The waiting time for the just registered module may be
// shorter than all other registered modules.
wake_up_->Set();
wake_up_.Set();
}
void ProcessThreadImpl::DeRegisterModule(Module* module) {
@ -217,7 +217,7 @@ bool ProcessThreadImpl::Process() {
int64_t time_to_wait = next_checkpoint - rtc::TimeMillis();
if (time_to_wait > 0)
wake_up_->Wait(static_cast<unsigned long>(time_to_wait));
wake_up_.Wait(static_cast<int>(time_to_wait));
return true;
}