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

Side by Side Diff: runtime/vm/thread_registry.cc

Issue 1491283002: VM: Fix crash in profile signal handler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | 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_registry.h" 5 #include "vm/thread_registry.h"
6 6
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 101
102 void ThreadRegistry::Unschedule(Thread* thread, 102 void ThreadRegistry::Unschedule(Thread* thread,
103 bool is_mutator, 103 bool is_mutator,
104 bool bypass_safepoint) { 104 bool bypass_safepoint) {
105 MonitorLocker ml(monitor_); 105 MonitorLocker ml(monitor_);
106 OSThread* os_thread = thread->os_thread(); 106 OSThread* os_thread = thread->os_thread();
107 ASSERT(os_thread != NULL); 107 ASSERT(os_thread != NULL);
108 os_thread->DisableThreadInterrupts(); 108 os_thread->DisableThreadInterrupts();
109 os_thread->set_thread(NULL);
110 OSThread::SetCurrent(os_thread);
109 thread->isolate_ = NULL; 111 thread->isolate_ = NULL;
110 thread->heap_ = NULL; 112 thread->heap_ = NULL;
111 thread->set_os_thread(NULL); 113 thread->set_os_thread(NULL);
112 os_thread->set_thread(NULL);
113 OSThread::SetCurrent(os_thread);
114 if (!is_mutator) { 114 if (!is_mutator) {
115 ASSERT(thread->api_top_scope() == NULL); 115 ASSERT(thread->api_top_scope() == NULL);
116 ReturnThreadToFreelist(thread); 116 ReturnThreadToFreelist(thread);
117 } 117 }
118 if (!bypass_safepoint && in_rendezvous_) { 118 if (!bypass_safepoint && in_rendezvous_) {
119 // Don't wait for this thread. 119 // Don't wait for this thread.
120 ASSERT(remaining_ > 0); 120 ASSERT(remaining_ > 0);
121 if (--remaining_ == 0) { 121 if (--remaining_ == 0) {
122 ml.NotifyAll(); 122 ml.NotifyAll();
123 } 123 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 intptr_t count = 0; 220 intptr_t count = 0;
221 Thread* current = active_list_; 221 Thread* current = active_list_;
222 while (current != NULL) { 222 while (current != NULL) {
223 ++count; 223 ++count;
224 current = current->next_; 224 current = current->next_;
225 } 225 }
226 return count; 226 return count;
227 } 227 }
228 228
229 } // namespace dart 229 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698