Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: runtime/vm/thread.cc

Issue 1410293006: Use ExitProcess on Windows. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add comment Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698