Make rtc::Thread a TaskQueue

in support of converging on single way to run asynchronous tasks in webrtc

Bug: b/144982320
Change-Id: I200ad298136d11764a3f5c0547ebcba51aceafa0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158782
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29896}
This commit is contained in:
Danil Chapovalov
2019-11-22 15:52:40 +01:00
committed by Commit Bot
parent 2aaf4afb09
commit 912b3b83b3
5 changed files with 79 additions and 8 deletions

View File

@ -114,15 +114,11 @@ bool RtcEventLogImpl::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
void RtcEventLogImpl::StopLogging() {
RTC_LOG(LS_INFO) << "Stopping WebRTC event log.";
// TODO(danilchap): Do not block current thread waiting on the task queue.
// It might work for now, for current callers, but disallows caller to share
// threads with the |task_queue_|.
rtc::Event output_stopped;
StopLogging([&output_stopped]() { output_stopped.Set(); });
// By making sure StopLogging() is not executed on a task queue,
// we ensure it's not running on a thread that is shared with |task_queue_|,
// meaning the following Wait() will not block forever.
RTC_DCHECK(TaskQueueBase::Current() == nullptr);
output_stopped.Wait(rtc::Event::kForever);
RTC_LOG(LS_INFO) << "WebRTC event log successfully stopped.";