Migrate rtc_base to webrtc::Mutex.
Bug: webrtc:11567
Change-Id: Ib8630e0cf1266e7c3f8ce718e1ed9f8848f42ec8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178806
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31682}
diff --git a/rtc_base/task_queue_stdlib.cc b/rtc_base/task_queue_stdlib.cc
index 7052f7c..5de6345 100644
--- a/rtc_base/task_queue_stdlib.cc
+++ b/rtc_base/task_queue_stdlib.cc
@@ -22,10 +22,10 @@
#include "api/task_queue/queued_task.h"
#include "api/task_queue/task_queue_base.h"
#include "rtc_base/checks.h"
-#include "rtc_base/critical_section.h"
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "rtc_base/platform_thread.h"
+#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/time_utils.h"
@@ -97,7 +97,7 @@
// tasks (including delayed tasks).
rtc::PlatformThread thread_;
- rtc::CriticalSection pending_lock_;
+ Mutex pending_lock_;
// Indicates if the worker thread needs to shutdown now.
bool thread_should_quit_ RTC_GUARDED_BY(pending_lock_){false};
@@ -135,7 +135,7 @@
RTC_DCHECK(!IsCurrent());
{
- rtc::CritScope lock(&pending_lock_);
+ MutexLock lock(&pending_lock_);
thread_should_quit_ = true;
}
@@ -148,7 +148,7 @@
void TaskQueueStdlib::PostTask(std::unique_ptr<QueuedTask> task) {
{
- rtc::CritScope lock(&pending_lock_);
+ MutexLock lock(&pending_lock_);
OrderId order = thread_posting_order_++;
pending_queue_.push(std::pair<OrderId, std::unique_ptr<QueuedTask>>(
@@ -166,7 +166,7 @@
delay.next_fire_at_ms_ = fire_at;
{
- rtc::CritScope lock(&pending_lock_);
+ MutexLock lock(&pending_lock_);
delay.order_ = ++thread_posting_order_;
delayed_queue_[delay] = std::move(task);
}
@@ -179,7 +179,7 @@
auto tick = rtc::TimeMillis();
- rtc::CritScope lock(&pending_lock_);
+ MutexLock lock(&pending_lock_);
if (thread_should_quit_) {
result.final_task_ = true;