| Index: runtime/vm/dart.cc
|
| diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
|
| index 4fd93cb190ae0d0ee5759ad7fbce3e6a8a8c1890..d4a984a1bdec9b7606c2d4d9646e4c2ca5a2c4d8 100644
|
| --- a/runtime/vm/dart.cc
|
| +++ b/runtime/vm/dart.cc
|
| @@ -114,8 +114,6 @@ const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
| ASSERT(predefined_handles_ == NULL);
|
| predefined_handles_ = new ReadOnlyHandles();
|
| // Create the VM isolate and finish the VM initialization.
|
| - ASSERT(thread_pool_ == NULL);
|
| - thread_pool_ = new ThreadPool();
|
| {
|
| ASSERT(vm_isolate_ == NULL);
|
| ASSERT(Flags::Initialized());
|
| @@ -198,34 +196,25 @@ const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|
|
|
|
| const char* Dart::Cleanup() {
|
| - // Shutdown the service isolate before shutting down the thread pool.
|
| - ServiceIsolate::Shutdown();
|
| -#if 0
|
| - // Ideally we should shutdown the VM isolate here, but the thread pool
|
| - // shutdown does not seem to ensure that all the threads have stopped
|
| - // execution before it terminates, this results in racing isolates.
|
| + ASSERT(Isolate::Current() == NULL);
|
| if (vm_isolate_ == NULL) {
|
| return "VM already terminated.";
|
| }
|
|
|
| - ASSERT(Isolate::Current() == NULL);
|
| + // Shutdown the service isolate before shutting down the thread pool.
|
| + ServiceIsolate::Shutdown();
|
|
|
| - delete thread_pool_;
|
| - thread_pool_ = NULL;
|
| + // Shutdown the thread pool. On return, all thread pool threads have exited.
|
| + ThreadPool::Shutdown();
|
|
|
| // Set the VM isolate as current isolate.
|
| Thread::EnsureInit();
|
| Thread::EnterIsolate(vm_isolate_);
|
|
|
| - // There is a planned and known asymmetry here: We exit one scope for the VM
|
| - // isolate to account for the scope that was entered in Dart_InitOnce.
|
| - Dart_ExitScope();
|
| -
|
| ShutdownIsolate();
|
| vm_isolate_ = NULL;
|
|
|
| TargetCPUFeatures::Cleanup();
|
| -#endif
|
|
|
| Profiler::Shutdown();
|
| CodeObservers::DeleteAll();
|
|
|