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

Unified Diff: runtime/vm/os_thread.cc

Issue 1557033002: Fixes for OSThread creation shutdown race. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | « runtime/vm/os_thread.h ('k') | runtime/vm/thread_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread.cc
diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc
index f6a7498280a6a2545b49266a08391066d99aced8..5b2d6e34d1310e0a80ef1fa41163077bc52f3591 100644
--- a/runtime/vm/os_thread.cc
+++ b/runtime/vm/os_thread.cc
@@ -36,18 +36,13 @@ OSThread::OSThread() :
OSThread* OSThread::CreateOSThread() {
- if (thread_list_lock_ == NULL) {
+ MutexLocker ml(thread_list_lock_);
+ if (!creation_enabled_) {
return NULL;
}
- {
- MutexLocker ml(thread_list_lock_);
- if (!creation_enabled_) {
- return NULL;
- }
- OSThread* os_thread = new OSThread();
- AddThreadToListLocked(os_thread);
- return os_thread;
- }
+ OSThread* os_thread = new OSThread();
+ AddThreadToListLocked(os_thread);
+ return os_thread;
}
@@ -121,15 +116,18 @@ void OSThread::InitOnce() {
void OSThread::Cleanup() {
if (thread_list_lock_ != NULL) {
+ // We cannot delete the key, yet. See the note about thread_list_lock_.
// Delete the thread local key.
- ASSERT(thread_key_ != kUnsetThreadLocalKey);
- DeleteThreadLocal(thread_key_);
- thread_key_ = kUnsetThreadLocalKey;
+ // ASSERT(thread_key_ != kUnsetThreadLocalKey);
+ // DeleteThreadLocal(thread_key_);
+ // thread_key_ = kUnsetThreadLocalKey;
+ // The thread_list_lock_ cannot be deleted without a bit more cleverness.
+ // See the note in os_thread.h.
// Delete the global OSThread lock.
- ASSERT(thread_list_lock_ != NULL);
- delete thread_list_lock_;
- thread_list_lock_ = NULL;
+ // ASSERT(thread_list_lock_ != NULL);
+ // delete thread_list_lock_;
+ // thread_list_lock_ = NULL;
}
siva 2016/01/04 23:07:55 Since everything inside the 'if statement' is comm
zra 2016/01/04 23:21:53 Done.
}
« no previous file with comments | « runtime/vm/os_thread.h ('k') | runtime/vm/thread_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698