Chromium Code Reviews| Index: runtime/vm/os_thread.cc |
| diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc |
| index f6a7498280a6a2545b49266a08391066d99aced8..5b2d6e34d1310e0a80ef1fa41163077bc52f3591 100644 |
| --- a/runtime/vm/os_thread.cc |
| +++ b/runtime/vm/os_thread.cc |
| @@ -36,18 +36,13 @@ OSThread::OSThread() : |
| OSThread* OSThread::CreateOSThread() { |
| - if (thread_list_lock_ == NULL) { |
| + MutexLocker ml(thread_list_lock_); |
| + if (!creation_enabled_) { |
| return NULL; |
| } |
| - { |
| - MutexLocker ml(thread_list_lock_); |
| - if (!creation_enabled_) { |
| - return NULL; |
| - } |
| - OSThread* os_thread = new OSThread(); |
| - AddThreadToListLocked(os_thread); |
| - return os_thread; |
| - } |
| + OSThread* os_thread = new OSThread(); |
| + AddThreadToListLocked(os_thread); |
| + return os_thread; |
| } |
| @@ -121,15 +116,18 @@ void OSThread::InitOnce() { |
| void OSThread::Cleanup() { |
| if (thread_list_lock_ != NULL) { |
| + // We cannot delete the key, yet. See the note about thread_list_lock_. |
| // Delete the thread local key. |
| - ASSERT(thread_key_ != kUnsetThreadLocalKey); |
| - DeleteThreadLocal(thread_key_); |
| - thread_key_ = kUnsetThreadLocalKey; |
| + // ASSERT(thread_key_ != kUnsetThreadLocalKey); |
| + // DeleteThreadLocal(thread_key_); |
| + // thread_key_ = kUnsetThreadLocalKey; |
| + // The thread_list_lock_ cannot be deleted without a bit more cleverness. |
| + // See the note in os_thread.h. |
| // Delete the global OSThread lock. |
| - ASSERT(thread_list_lock_ != NULL); |
| - delete thread_list_lock_; |
| - thread_list_lock_ = NULL; |
| + // ASSERT(thread_list_lock_ != NULL); |
| + // delete thread_list_lock_; |
| + // thread_list_lock_ = NULL; |
| } |
|
siva
2016/01/04 23:07:55
Since everything inside the 'if statement' is comm
zra
2016/01/04 23:21:53
Done.
|
| } |