Index: webrtc/base/thread.cc |
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc |
index 66542bb3d90712cfc927d1d9f225e2055aacaddf..f48f0f78be24dd8af4aac0b3be70d3754525cc81 100644 |
--- a/webrtc/base/thread.cc |
+++ b/webrtc/base/thread.cc |
@@ -31,23 +31,24 @@ ThreadManager* ThreadManager::Instance() { |
return &thread_manager; |
} |
+ThreadManager::~ThreadManager() { |
+ // By above RTC_DEFINE_STATIC_LOCAL. |
+ RTC_NOTREACHED() << "ThreadManager should never be destructed."; |
Taylor Brandstetter
2017/04/21 09:54:28
But it has a public constructor/destructor, so a n
nisse-webrtc
2017/04/21 11:06:07
I'd prefer to not add the bookkeeping needed to un
Taylor Brandstetter
2017/04/21 11:32:54
Let's try making the constructor/destructor privat
|
+} |
+ |
// static |
Thread* Thread::Current() { |
+#ifdef NO_MAIN_THREAD_WRAPPING |
return ThreadManager::Instance()->CurrentThread(); |
+#else |
+ return ThreadManager::Instance()->WrapCurrentThread(); |
+#endif |
} |
#if defined(WEBRTC_POSIX) |
#if !defined(WEBRTC_MAC) |
ThreadManager::ThreadManager() { |
pthread_key_create(&key_, nullptr); |
-#ifndef NO_MAIN_THREAD_WRAPPING |
- WrapCurrentThread(); |
-#endif |
-} |
- |
-ThreadManager::~ThreadManager() { |
- UnwrapCurrentThread(); |
- pthread_key_delete(key_); |
} |
#endif |
@@ -63,14 +64,6 @@ void ThreadManager::SetCurrentThread(Thread *thread) { |
#if defined(WEBRTC_WIN) |
ThreadManager::ThreadManager() { |
key_ = TlsAlloc(); |
-#ifndef NO_MAIN_THREAD_WRAPPING |
- WrapCurrentThread(); |
-#endif |
-} |
- |
-ThreadManager::~ThreadManager() { |
- UnwrapCurrentThread(); |
- TlsFree(key_); |
} |
Thread *ThreadManager::CurrentThread() { |