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

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: 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 | « 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..0dcd50602a67d93bdba284f8b3da1e2aa305ce48 100644
--- a/runtime/vm/os_thread.cc
+++ b/runtime/vm/os_thread.cc
@@ -36,18 +36,14 @@ OSThread::OSThread() :
OSThread* OSThread::CreateOSThread() {
- if (thread_list_lock_ == NULL) {
+ ASSERT(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;
}
@@ -120,6 +116,9 @@ void OSThread::InitOnce() {
void OSThread::Cleanup() {
+ // We cannot delete the thread local key and thread list lock, yet.
+ // See the note on thread_list_lock_ in os_thread.h.
+#if 0
if (thread_list_lock_ != NULL) {
// Delete the thread local key.
ASSERT(thread_key_ != kUnsetThreadLocalKey);
@@ -131,6 +130,7 @@ void OSThread::Cleanup() {
delete thread_list_lock_;
thread_list_lock_ = NULL;
}
+#endif
}
« 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