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

Unified Diff: runtime/vm/thread_pool.cc

Issue 1555643002: Thread fixes for shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/os_thread.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_pool.cc
diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc
index 86d2f609db871a78995d25f75e8118c1e8c53a0b..4b1fb24a63504f4bbd1d94ce6c6e00a3a1968a3b 100644
--- a/runtime/vm/thread_pool.cc
+++ b/runtime/vm/thread_pool.cc
@@ -107,10 +107,18 @@ void ThreadPool::Shutdown() {
while (current != NULL) {
Worker* next = current->all_next_;
ThreadId currentId = current->id();
- if (currentId != id) {
+ if (currentId == OSThread::kInvalidThreadId) {
+ // If the thread id is invalid, it means the thread never started
+ // because OSThread creation was disabled. Destroy the Task and Worker.
+ delete current->task_;
+ delete current;
+ current = NULL;
+ } else if (currentId != id) {
AddWorkerToShutdownList(current);
}
- current->Shutdown();
+ if (current != NULL) {
+ current->Shutdown();
siva 2015/12/30 20:51:02 Why is it necessary to call current->Shutdown() wh
zra 2015/12/30 22:36:28 Thinking about this more, it is not safe for a thr
+ }
current = next;
}
saved = NULL;
« no previous file with comments | « runtime/vm/os_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698