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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/thread.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/growable_array.h" 7 #include "vm/growable_array.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 #include "vm/log.h" 10 #include "vm/log.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 120
121 static void DeleteThread(void* thread) { 121 static void DeleteThread(void* thread) {
122 delete reinterpret_cast<Thread*>(thread); 122 delete reinterpret_cast<Thread*>(thread);
123 } 123 }
124 124
125 125
126 void Thread::Shutdown() { 126 void Thread::Shutdown() {
127 if (thread_list_lock_ != NULL) { 127 if (thread_list_lock_ != NULL) {
128 // Delete the current thread.
129 Thread* thread = Current();
130 ASSERT(thread != NULL);
131 delete thread;
132 thread = NULL;
133 SetCurrent(NULL);
134
135 // Check that there are no more threads, then delete the lock.
136 {
137 MutexLocker ml(thread_list_lock_);
138 ASSERT(thread_list_head_ == NULL);
139 }
140
141 // Clean up TLS.
142 OSThread::DeleteThreadLocal(thread_key_);
143 thread_key_ = OSThread::kUnsetThreadLocalKey;
144
145 // Delete the thread list lock.
128 delete thread_list_lock_; 146 delete thread_list_lock_;
129 thread_list_lock_ = NULL; 147 thread_list_lock_ = NULL;
130 } 148 }
131 } 149 }
132 150
133 151
134 Thread::~Thread() { 152 Thread::~Thread() {
135 // We should cleanly exit any isolate before destruction. 153 // We should cleanly exit any isolate before destruction.
136 ASSERT(isolate_ == NULL); 154 ASSERT(isolate_ == NULL);
137 // Clear |this| from all isolate's thread registry. 155 // Clear |this| from all isolate's thread registry.
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 Thread* ThreadIterator::Next() { 584 Thread* ThreadIterator::Next() {
567 ASSERT(Thread::thread_list_lock_ != NULL); 585 ASSERT(Thread::thread_list_lock_ != NULL);
568 ASSERT(Thread::thread_list_lock_->IsOwnedByCurrentThread()); 586 ASSERT(Thread::thread_list_lock_->IsOwnedByCurrentThread());
569 Thread* current = next_; 587 Thread* current = next_;
570 next_ = next_->thread_list_next_; 588 next_ = next_->thread_list_next_;
571 return current; 589 return current;
572 } 590 }
573 591
574 592
575 } // namespace dart 593 } // namespace dart
OLDNEW
« 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