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

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: Avoid shutdown race; remove detroyed_ flag. 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_linux.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..eb79659850c0e8c3d6d3c18e01e0530acf4e7079 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1432,6 +1432,14 @@ void Isolate::Shutdown() {
heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked);
}
#endif // DEBUG
+ 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();
+ }
+ }
siva 2015/07/13 23:37:00 I am wondering if we should do this wait after rem
koda 2015/07/14 00:41:40 Done.
// Remove this isolate from the list *before* we start tearing it down, to
// avoid exposing it in a state of decay.
@@ -1490,6 +1498,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_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698