From b952a90038aea9459e91f0ae7c9c127ab4e637dd Mon Sep 17 00:00:00 2001 From: "tommi@webrtc.org" Date: Thu, 8 Nov 2012 13:40:59 +0000 Subject: [PATCH] Remove an unused Shutdown method from the ThreadWrapper interface. The method was flagged by Chrome engineers as dubious since it uses TerminateThread. As it turns out, we don't use this method anywhere, so we can simply remove it! :) BUG=1066 Review URL: https://webrtc-codereview.appspot.com/938012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3065 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/system_wrappers/interface/thread_wrapper.h | 5 ----- webrtc/system_wrappers/source/thread_posix.cc | 14 -------------- webrtc/system_wrappers/source/thread_posix.h | 1 - webrtc/system_wrappers/source/thread_win.cc | 14 -------------- webrtc/system_wrappers/source/thread_win.h | 2 -- 5 files changed, 36 deletions(-) diff --git a/webrtc/system_wrappers/interface/thread_wrapper.h b/webrtc/system_wrappers/interface/thread_wrapper.h index cda4827b01..edfc4bf52b 100644 --- a/webrtc/system_wrappers/interface/thread_wrapper.h +++ b/webrtc/system_wrappers/interface/thread_wrapper.h @@ -88,11 +88,6 @@ public: // Multiple tries to Stop are allowed (e.g. to wait longer than 2 seconds). // It's ok to call Stop() even if the spawned thread has been reclaimed. virtual bool Stop() = 0; - - // Stops the spawned thread dead in its tracks. Will likely result in a - // corrupt state. There should be an extremely good reason for even looking - // at this function. Can cause many problems deadlock being one of them. - virtual bool Shutdown() {return false;} }; } // namespace webrtc diff --git a/webrtc/system_wrappers/source/thread_posix.cc b/webrtc/system_wrappers/source/thread_posix.cc index 35c9f8171a..dd78a70efe 100644 --- a/webrtc/system_wrappers/source/thread_posix.cc +++ b/webrtc/system_wrappers/source/thread_posix.cc @@ -306,20 +306,6 @@ void ThreadPosix::SetNotAlive() _alive = false; } -bool ThreadPosix::Shutdown() -{ -#if !defined(WEBRTC_ANDROID) - if (_thread && (0 != pthread_cancel(_thread))) - { - return false; - } - - return true; -#else - return false; -#endif -} - bool ThreadPosix::Stop() { bool dead = false; diff --git a/webrtc/system_wrappers/source/thread_posix.h b/webrtc/system_wrappers/source/thread_posix.h index 8fcdf10ced..f83e2f9b02 100644 --- a/webrtc/system_wrappers/source/thread_posix.h +++ b/webrtc/system_wrappers/source/thread_posix.h @@ -38,7 +38,6 @@ public: virtual bool SetAffinity(const int* processorNumbers, unsigned int amountOfProcessors); virtual bool Stop(); - virtual bool Shutdown(); void Run(); diff --git a/webrtc/system_wrappers/source/thread_win.cc b/webrtc/system_wrappers/source/thread_win.cc index f458e0e9c1..8d43764329 100644 --- a/webrtc/system_wrappers/source/thread_win.cc +++ b/webrtc/system_wrappers/source/thread_win.cc @@ -133,20 +133,6 @@ void ThreadWindows::SetNotAlive() _alive = false; } -bool ThreadWindows::Shutdown() -{ - DWORD exitCode = 0; - BOOL ret = TRUE; - if (_thread) - { - ret = TerminateThread(_thread, exitCode); - _alive = false; - _dead = true; - _thread = NULL; - } - return ret == TRUE; -} - bool ThreadWindows::Stop() { _critsectStop->Enter(); diff --git a/webrtc/system_wrappers/source/thread_win.h b/webrtc/system_wrappers/source/thread_win.h index 4fd7523ec9..e73c8fd086 100644 --- a/webrtc/system_wrappers/source/thread_win.h +++ b/webrtc/system_wrappers/source/thread_win.h @@ -34,8 +34,6 @@ public: static unsigned int WINAPI StartThread(LPVOID lpParameter); - virtual bool Shutdown(); - protected: virtual void Run();