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

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

Issue 1408923005: Add IsMutatorThread to the Thread class and use it instead of MutatorThreadIsCurrentThread (Closed) Base URL: git@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/vm/debugger.h ('K') | « runtime/vm/thread.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_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 15 matching lines...) Expand all
26 // Start a new round. 26 // Start a new round.
27 in_rendezvous_ = true; 27 in_rendezvous_ = true;
28 ++round_; // Overflows after 240+ years @ 10^9 safepoints per second. 28 ++round_; // Overflows after 240+ years @ 10^9 safepoints per second.
29 remaining_ = CountScheduledLocked(); 29 remaining_ = CountScheduledLocked();
30 Isolate* isolate = Isolate::Current(); 30 Isolate* isolate = Isolate::Current();
31 // We only expect this method to be called from within the isolate itself. 31 // We only expect this method to be called from within the isolate itself.
32 ASSERT(isolate->thread_registry() == this); 32 ASSERT(isolate->thread_registry() == this);
33 // TODO(koda): Rename Thread::PrepareForGC and call it here? 33 // TODO(koda): Rename Thread::PrepareForGC and call it here?
34 --remaining_; // Exclude this thread from the count. 34 --remaining_; // Exclude this thread from the count.
35 // Ensure the main mutator will reach a safepoint (could be running Dart). 35 // Ensure the main mutator will reach a safepoint (could be running Dart).
36 if (!isolate->MutatorThreadIsCurrentThread()) { 36 if (!Thread::Current()->IsMutatorThread()) {
37 isolate->ScheduleInterrupts(Isolate::kVMInterrupt); 37 isolate->ScheduleInterrupts(Isolate::kVMInterrupt);
38 } 38 }
39 while (remaining_ > 0) { 39 while (remaining_ > 0) {
40 ml.Wait(Monitor::kNoTimeout); 40 ml.Wait(Monitor::kNoTimeout);
41 } 41 }
42 } 42 }
43 43
44 44
45 void ThreadRegistry::ResumeAllThreads() { 45 void ThreadRegistry::ResumeAllThreads() {
46 MonitorLocker ml(monitor_); 46 MonitorLocker ml(monitor_);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 for (int i = 0; i < entries_.length(); ++i) { 145 for (int i = 0; i < entries_.length(); ++i) {
146 const Entry& entry = entries_[i]; 146 const Entry& entry = entries_[i];
147 if (entry.scheduled) { 147 if (entry.scheduled) {
148 ++count; 148 ++count;
149 } 149 }
150 } 150 }
151 return count; 151 return count;
152 } 152 }
153 153
154 } // namespace dart 154 } // namespace dart
OLDNEW
« runtime/vm/debugger.h ('K') | « runtime/vm/thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698