Reland "Migrate test/time_controller to webrtc::Mutex." This is a reland of 52fd96fb731d9a911bd064a9718d96fef0bd5b24 Original change's description: > Migrate test/time_controller to webrtc::Mutex. > > Bug: webrtc:11567 > Change-Id: I26fb07bf84ed197ce667290aa0bf4816bc9c5c06 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178818 > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > Commit-Queue: Markus Handell <handellm@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31660} Bug: webrtc:11567 Change-Id: I4979b6be8ac5ec661e0f18cca4d0c185916233bb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178876 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31687}
diff --git a/test/time_controller/simulated_thread.cc b/test/time_controller/simulated_thread.cc index 8d1637c..8071264 100644 --- a/test/time_controller/simulated_thread.cc +++ b/test/time_controller/simulated_thread.cc
@@ -59,7 +59,7 @@ CurrentThreadSetter set_current(this); ProcessMessages(0); int delay_ms = GetDelay(); - rtc::CritScope lock(&lock_); + MutexLock lock(&lock_); if (delay_ms == kForever) { next_run_time_ = Timestamp::PlusInfinity(); } else { @@ -95,7 +95,7 @@ rtc::MessageData* pdata, bool time_sensitive) { rtc::Thread::Post(posted_from, phandler, id, pdata, time_sensitive); - rtc::CritScope lock(&lock_); + MutexLock lock(&lock_); next_run_time_ = Timestamp::MinusInfinity(); } @@ -105,7 +105,7 @@ uint32_t id, rtc::MessageData* pdata) { rtc::Thread::PostDelayed(posted_from, delay_ms, phandler, id, pdata); - rtc::CritScope lock(&lock_); + MutexLock lock(&lock_); next_run_time_ = std::min(next_run_time_, Timestamp::Millis(rtc::TimeMillis() + delay_ms)); } @@ -116,7 +116,7 @@ uint32_t id, rtc::MessageData* pdata) { rtc::Thread::PostAt(posted_from, target_time_ms, phandler, id, pdata); - rtc::CritScope lock(&lock_); + MutexLock lock(&lock_); next_run_time_ = std::min(next_run_time_, Timestamp::Millis(target_time_ms)); }