| Index: runtime/vm/thread.cc
|
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
|
| index 5c635b9be57e6009e06a129f78d01e162070cffa..a19440d0799edf3719542aa4b06416b006997ded 100644
|
| --- a/runtime/vm/thread.cc
|
| +++ b/runtime/vm/thread.cc
|
| @@ -125,6 +125,24 @@ static void DeleteThread(void* thread) {
|
|
|
| void Thread::Shutdown() {
|
| if (thread_list_lock_ != NULL) {
|
| + // Delete the current thread.
|
| + Thread* thread = Current();
|
| + ASSERT(thread != NULL);
|
| + delete thread;
|
| + thread = NULL;
|
| + SetCurrent(NULL);
|
| +
|
| + // Check that there are no more threads, then delete the lock.
|
| + {
|
| + MutexLocker ml(thread_list_lock_);
|
| + ASSERT(thread_list_head_ == NULL);
|
| + }
|
| +
|
| + // Clean up TLS.
|
| + OSThread::DeleteThreadLocal(thread_key_);
|
| + thread_key_ = OSThread::kUnsetThreadLocalKey;
|
| +
|
| + // Delete the thread list lock.
|
| delete thread_list_lock_;
|
| thread_list_lock_ = NULL;
|
| }
|
|
|