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

Unified Diff: runtime/vm/thread.cc

Issue 1397883007: Don't cleanup thread list mutex until VM shutdown is clean (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/dart.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.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index f431dfdd4ce35779c608466a57aecb60389c33e7..346e5f02f04339bcc1594a992a2872d7c9e8317d 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -24,7 +24,7 @@ namespace dart {
// for a thread.
ThreadLocalKey Thread::thread_key_ = OSThread::kUnsetThreadLocalKey;
Thread* Thread::thread_list_head_ = NULL;
-Mutex* Thread::thread_list_lock_;
+Mutex* Thread::thread_list_lock_ = NULL;
// Remove |thread| from each isolate's thread registry.
class ThreadPruner : public IsolateVisitor {
@@ -47,6 +47,7 @@ class ThreadPruner : public IsolateVisitor {
void Thread::AddThreadToList(Thread* thread) {
ASSERT(thread != NULL);
ASSERT(thread->isolate() == NULL);
+ ASSERT(thread_list_lock_ != NULL);
MutexLocker ml(thread_list_lock_);
ASSERT(thread->thread_list_next_ == NULL);
@@ -71,6 +72,7 @@ void Thread::AddThreadToList(Thread* thread) {
void Thread::RemoveThreadFromList(Thread* thread) {
ASSERT(thread != NULL);
ASSERT(thread->isolate() == NULL);
+ ASSERT(thread_list_lock_ != NULL);
MutexLocker ml(thread_list_lock_);
// Handle case where |thread| is head of list.
@@ -125,11 +127,13 @@ Thread::~Thread() {
void Thread::InitOnceBeforeIsolate() {
+ ASSERT(thread_list_lock_ == NULL);
+ thread_list_lock_ = new Mutex();
+ ASSERT(thread_list_lock_ != NULL);
ASSERT(thread_key_ == OSThread::kUnsetThreadLocalKey);
thread_key_ = OSThread::CreateThreadLocal(DeleteThread);
ASSERT(thread_key_ != OSThread::kUnsetThreadLocalKey);
ASSERT(Thread::Current() == NULL);
- thread_list_lock_ = new Mutex();
// Allocate a new Thread and postpone initialization of VM constants for
// this first thread.
Thread* thread = new Thread(false);
« no previous file with comments | « runtime/vm/dart.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698