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

Unified Diff: runtime/vm/dart.cc

Issue 1557033002: Fixes for OSThread creation shutdown race. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 12 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 | « no previous file | runtime/vm/os_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart.cc
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 96dc5986e72bae70741b1dab41c73609d28e8544..8a5e91b53ed0f86162fcc9da2480d55eac14cc76 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -248,15 +248,18 @@ const char* Dart::Cleanup() {
// before shutting down the thread pool.
WaitForIsolateShutdown();
+ // Shutdown the thread pool. On return, all thread pool threads have exited.
+ delete thread_pool_;
+ thread_pool_ = NULL;
+
// Disable creation of any new OSThread structures which means no more new
// threads can do an EnterIsolate. This must come after isolate shutdown
// because new threads may need to be spawned to shutdown the isolates.
+ // This must come after deletion of the thread pool to avoid a race in which
+ // a thread spawned by the thread pool does not exit through the thread
+ // pool, messing up its bookkeeping.
OSThread::DisableOSThreadCreation();
- // Shutdown the thread pool. On return, all thread pool threads have exited.
- delete thread_pool_;
- thread_pool_ = NULL;
-
// Set the VM isolate as current isolate.
bool result = Thread::EnterIsolate(vm_isolate_);
ASSERT(result);
« no previous file with comments | « no previous file | runtime/vm/os_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698