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

Unified Diff: runtime/vm/thread_registry.cc

Issue 1533023002: - Make sure to prepare all threads for GC. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread_registry.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_registry.cc
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc
index 9a57793682d037ea006c2692888e7920d1dcd84d..51488084331d539b55ebd74aec811a389a717aeb 100644
--- a/runtime/vm/thread_registry.cc
+++ b/runtime/vm/thread_registry.cc
@@ -46,7 +46,6 @@ void ThreadRegistry::SafepointThreads() {
Isolate* isolate = Isolate::Current();
// We only expect this method to be called from within the isolate itself.
ASSERT(isolate->thread_registry() == this);
- // TODO(koda): Rename Thread::PrepareForGC and call it here?
--remaining_; // Exclude this thread from the count.
// Ensure the main mutator will reach a safepoint (could be running Dart).
if (!Thread::Current()->IsMutatorThread()) {
@@ -154,6 +153,16 @@ void ThreadRegistry::VisitObjectPointers(ObjectPointerVisitor* visitor,
}
+void ThreadRegistry::PrepareForGC() {
+ MonitorLocker ml(monitor_);
+ Thread* thread = active_list_;
+ while (thread != NULL) {
+ thread->PrepareForGC();
+ thread = thread->next_;
+ }
+}
+
+
void ThreadRegistry::AddThreadToActiveList(Thread* thread) {
ASSERT(thread != NULL);
ASSERT(monitor_->IsOwnedByCurrentThread());
@@ -215,7 +224,6 @@ void ThreadRegistry::CheckSafepointLocked() {
ASSERT((last_round == -1) || (round_ == (last_round + 1)));
last_round = round_;
// Participate in this round.
- // TODO(koda): Rename Thread::PrepareForGC and call it here?
if (--remaining_ == 0) {
// Ensure the organizing thread is notified.
// TODO(koda): Use separate condition variables and plain 'Notify'.
« no previous file with comments | « runtime/vm/thread_registry.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698