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

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: 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
« runtime/bin/thread_win.cc ('K') | « runtime/bin/thread_win.cc ('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 Thread* thread = Current();
129 ASSERT(thread != NULL);
130 delete thread;
131 thread = NULL;
132 SetCurrent(NULL);
133 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.
134 thread_key_ = OSThread::kUnsetThreadLocalKey;
135
136 // Check that there are no more threads, then delete the lock.
137 {
138 MutexLocker ml(thread_list_lock_);
139 ASSERT(thread_list_head_ == NULL);
140 }
128 delete thread_list_lock_; 141 delete thread_list_lock_;
129 thread_list_lock_ = NULL; 142 thread_list_lock_ = NULL;
130 } 143 }
131 } 144 }
132 145
133 146
134 Thread::~Thread() { 147 Thread::~Thread() {
135 // We should cleanly exit any isolate before destruction. 148 // We should cleanly exit any isolate before destruction.
136 ASSERT(isolate_ == NULL); 149 ASSERT(isolate_ == NULL);
137 // Clear |this| from all isolate's thread registry. 150 // Clear |this| from all isolate's thread registry.
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 Thread* ThreadIterator::Next() { 579 Thread* ThreadIterator::Next() {
567 ASSERT(Thread::thread_list_lock_ != NULL); 580 ASSERT(Thread::thread_list_lock_ != NULL);
568 ASSERT(Thread::thread_list_lock_->IsOwnedByCurrentThread()); 581 ASSERT(Thread::thread_list_lock_->IsOwnedByCurrentThread());
569 Thread* current = next_; 582 Thread* current = next_;
570 next_ = next_->thread_list_next_; 583 next_ = next_->thread_list_next_;
571 return current; 584 return current;
572 } 585 }
573 586
574 587
575 } // namespace dart 588 } // namespace dart
OLDNEW
« runtime/bin/thread_win.cc ('K') | « runtime/bin/thread_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698