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

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

Issue 1271773003: Allow threads to exit an isolate during rendezvous. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Another assertion. Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/thread_registry.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_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 {
11 11
12 void ThreadRegistry::SafepointThreads() { 12 void ThreadRegistry::SafepointThreads() {
13 MonitorLocker ml(monitor_); 13 MonitorLocker ml(monitor_);
14 // First wait for any older rounds that are still in progress. 14 // First wait for any older rounds that are still in progress.
15 while (in_rendezvous_) { 15 while (in_rendezvous_) {
16 // Assert we are not the organizer trying to nest calls to SafepointThreads.
17 ASSERT(remaining_ > 0);
16 CheckSafepointLocked(); 18 CheckSafepointLocked();
17 } 19 }
18 // Start a new round. 20 // Start a new round.
19 in_rendezvous_ = true; 21 in_rendezvous_ = true;
20 ++round_; // Overflows after 240+ years @ 10^9 safepoints per second. 22 ++round_; // Overflows after 240+ years @ 10^9 safepoints per second.
21 remaining_ = CountScheduledLocked(); 23 remaining_ = CountScheduledLocked();
22 Isolate* isolate = Isolate::Current(); 24 Isolate* isolate = Isolate::Current();
23 // We only expect this method to be called from within the isolate itself. 25 // We only expect this method to be called from within the isolate itself.
24 ASSERT(isolate->thread_registry() == this); 26 ASSERT(isolate->thread_registry() == this);
25 // TODO(koda): Rename Thread::PrepareForGC and call it here? 27 // TODO(koda): Rename Thread::PrepareForGC and call it here?
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 for (int i = 0; i < entries_.length(); ++i) { 75 for (int i = 0; i < entries_.length(); ++i) {
74 const Entry& entry = entries_[i]; 76 const Entry& entry = entries_[i];
75 if (entry.scheduled) { 77 if (entry.scheduled) {
76 ++count; 78 ++count;
77 } 79 }
78 } 80 }
79 return count; 81 return count;
80 } 82 }
81 83
82 } // namespace dart 84 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698