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

Unified Diff: runtime/vm/isolate.cc

Issue 1233563004: Avoid race in isolate shutdown; add assertions, error messages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Move wait per suggestion; port to all platforms. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/gc_sweeper.cc ('k') | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index b247e566b8934220435819e1734e2fa7738b14c7..bd19791cf8e74468e040ef9fb2423f77cd53f1c8 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1437,6 +1437,15 @@ void Isolate::Shutdown() {
// avoid exposing it in a state of decay.
RemoveIsolateFromList(this);
+ if (heap_ != NULL) {
+ // Wait for any concurrent GC tasks to finish before shutting down.
+ PageSpace* old_space = heap_->old_space();
+ MonitorLocker ml(old_space->tasks_lock());
+ while (old_space->tasks() > 0) {
+ ml.Wait();
+ }
+ }
+
// Create an area where we do have a zone and a handle scope so that we can
// call VM functions while tearing this isolate down.
{
@@ -1490,6 +1499,8 @@ void Isolate::Shutdown() {
// TODO(5411455): For now just make sure there are no current isolates
// as we are shutting down the isolate.
Thread::ExitIsolate();
+ // All threads should have exited by now.
+ thread_registry()->CheckNotScheduled(this);
Profiler::ShutdownProfilingForIsolate(this);
}
« no previous file with comments | « runtime/vm/gc_sweeper.cc ('k') | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698