From 6cea2b0f4b9e0c7f7919c23e8354ba6ca0fc2697 Mon Sep 17 00:00:00 2001 From: Tommi Date: Mon, 4 Dec 2017 18:51:16 +0100 Subject: [PATCH] Remove thread checker in thread.cc due to downstream issue. TBR=ossu@webrtc.org Bug: webrtc:8596 Change-Id: Ie36b18a2a66e08d8006e85c3a7783df74e157c92 Reviewed-on: https://webrtc-review.googlesource.com/29204 Commit-Queue: Tommi Reviewed-by: Tommi Cr-Commit-Position: refs/heads/master@{#21049} --- rtc_base/thread.cc | 10 ---------- rtc_base/thread.h | 16 +++++----------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc index 0d1003ea78..35507e0b32 100644 --- a/rtc_base/thread.cc +++ b/rtc_base/thread.cc @@ -183,7 +183,6 @@ bool Thread::SetName(const std::string& name, const void* obj) { } bool Thread::Start(Runnable* runnable) { - RTC_DCHECK_RUN_ON(&thread_checker_); RTC_DCHECK(!IsRunning()); if (IsRunning()) @@ -225,7 +224,6 @@ bool Thread::WrapCurrent() { } void Thread::UnwrapCurrent() { - RTC_DCHECK_RUN_ON(&thread_checker_); // Clears the platform-specific thread-specific storage. ThreadManager::Instance()->SetCurrentThread(nullptr); #if defined(WEBRTC_WIN) @@ -240,7 +238,6 @@ void Thread::UnwrapCurrent() { #elif defined(WEBRTC_POSIX) thread_ = 0; #endif - thread_checker_.DetachFromThread(); } void Thread::SafeWrapCurrent() { @@ -248,7 +245,6 @@ void Thread::SafeWrapCurrent() { } void Thread::Join() { - RTC_DCHECK_RUN_ON(&thread_checker_); if (!IsRunning()) return; @@ -268,7 +264,6 @@ void Thread::Join() { pthread_join(thread_, nullptr); thread_ = 0; #endif - thread_checker_.DetachFromThread(); } bool Thread::SetAllowBlockingCalls(bool allow) { @@ -316,16 +311,13 @@ void Thread::Run() { } bool Thread::IsOwned() { - RTC_DCHECK_RUN_ON(&thread_checker_); RTC_DCHECK(IsRunning()); return owned_; } void Thread::Stop() { - RTC_DCHECK_RUN_ON(&thread_checker_); MessageQueue::Quit(); Join(); - thread_checker_.DetachFromThread(); } void Thread::Send(const Location& posted_from, @@ -499,7 +491,6 @@ bool Thread::ProcessMessages(int cmsLoop) { bool Thread::WrapCurrentWithThreadManager(ThreadManager* thread_manager, bool need_synchronize_access) { - RTC_DCHECK_RUN_ON(&thread_checker_); RTC_DCHECK(!IsRunning()); #if defined(WEBRTC_WIN) @@ -522,7 +513,6 @@ bool Thread::WrapCurrentWithThreadManager(ThreadManager* thread_manager, } bool Thread::IsRunning() { - RTC_DCHECK_RUN_ON(&thread_checker_); #if defined(WEBRTC_WIN) return thread_ != nullptr; #elif defined(WEBRTC_POSIX) diff --git a/rtc_base/thread.h b/rtc_base/thread.h index d198ba83b9..ab6c7b1b50 100644 --- a/rtc_base/thread.h +++ b/rtc_base/thread.h @@ -24,7 +24,6 @@ #include "rtc_base/constructormagic.h" #include "rtc_base/messagequeue.h" #include "rtc_base/platform_thread_types.h" -#include "rtc_base/thread_checker.h" #if defined(WEBRTC_WIN) #include "rtc_base/win32.h" @@ -274,21 +273,16 @@ class RTC_LOCKABLE Thread : public MessageQueue { std::list<_SendMessage> sendlist_; std::string name_; - // Used to check access to unguarded thread control state variables and ensure - // that control functions are called on the right thread. - // The |thread_checker_| might represent a 'parent' thread from which - // Start()/Stop() are called or it could represent the worker thread itself in - // case the thread is wrapped since the functions that modified the control - // state will in this case be called from that thread. - ThreadChecker thread_checker_; + // TODO(tommi): Add thread checks for proper use of control methods. + // Ideally we should be able to just use PlatformThread. #if defined(WEBRTC_POSIX) - pthread_t thread_ RTC_ACCESS_ON(thread_checker_) = 0; + pthread_t thread_ = 0; #endif #if defined(WEBRTC_WIN) - HANDLE thread_ RTC_ACCESS_ON(thread_checker_) = nullptr; - DWORD thread_id_ RTC_ACCESS_ON(thread_checker_) = 0; + HANDLE thread_ = nullptr; + DWORD thread_id_ = 0; #endif // Indicates whether or not ownership of the worker thread lies with