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); |
} |