Chromium Code Reviews| Index: runtime/vm/thread.cc |
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc |
| index 5c635b9be57e6009e06a129f78d01e162070cffa..5e5266629120ad4b38ed3567f30dc74548f4e8f8 100644 |
| --- a/runtime/vm/thread.cc |
| +++ b/runtime/vm/thread.cc |
| @@ -125,6 +125,19 @@ static void DeleteThread(void* thread) { |
| void Thread::Shutdown() { |
| if (thread_list_lock_ != NULL) { |
| + Thread* thread = Current(); |
| + ASSERT(thread != NULL); |
| + delete thread; |
| + thread = NULL; |
| + SetCurrent(NULL); |
| + OSThread::DeleteThreadLocal(thread_key_); |
|
Cutch
2015/10/28 20:33:15
Can we move this TLS cleanup below the ASSERT.
O
zra
2015/10/28 21:40:04
Moved.
|
| + thread_key_ = OSThread::kUnsetThreadLocalKey; |
| + |
| + // Check that there are no more threads, then delete the lock. |
| + { |
| + MutexLocker ml(thread_list_lock_); |
| + ASSERT(thread_list_head_ == NULL); |
| + } |
| delete thread_list_lock_; |
| thread_list_lock_ = NULL; |
| } |