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

Side by Side Diff: runtime/vm/os_thread.cc

Issue 1515553003: VM: Fix deadlock in time line recording. (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/os_thread.h" 5 #include "vm/os_thread.h"
6 6
7 #include "vm/atomic.h" 7 #include "vm/atomic.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/thread_interrupter.h" 10 #include "vm/thread_interrupter.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // The single thread local key which stores all the thread local data 14 // The single thread local key which stores all the thread local data
15 // for a thread. 15 // for a thread.
16 ThreadLocalKey OSThread::thread_key_ = kUnsetThreadLocalKey; 16 ThreadLocalKey OSThread::thread_key_ = kUnsetThreadLocalKey;
17 OSThread* OSThread::thread_list_head_ = NULL; 17 OSThread* OSThread::thread_list_head_ = NULL;
18 Mutex* OSThread::thread_list_lock_ = NULL; 18 Mutex* OSThread::thread_list_lock_ = NULL;
19 19
20 20
21 OSThread::OSThread() : 21 OSThread::OSThread() :
22 BaseThread(true), 22 BaseThread(true),
23 id_(OSThread::GetCurrentThreadId()), 23 id_(OSThread::GetCurrentThreadId()),
24 join_id_(OSThread::GetCurrentThreadJoinId()), 24 join_id_(OSThread::GetCurrentThreadJoinId()),
25 trace_id_(OSThread::GetCurrentThreadTraceId()), 25 trace_id_(OSThread::GetCurrentThreadTraceId()),
26 name_(NULL), 26 name_(NULL),
27 timeline_block_lock_(new Mutex()), 27 timeline_block_lock_(new Mutex(/* recursive = */ true)),
28 timeline_block_(NULL), 28 timeline_block_(NULL),
29 thread_list_next_(NULL), 29 thread_list_next_(NULL),
30 thread_interrupt_disabled_(1), // Thread interrupts disabled by default. 30 thread_interrupt_disabled_(1), // Thread interrupts disabled by default.
31 log_(new class Log()), 31 log_(new class Log()),
32 stack_base_(0), 32 stack_base_(0),
33 thread_(NULL) { 33 thread_(NULL) {
34 AddThreadToList(this); 34 AddThreadToList(this);
35 } 35 }
36 36
37 37
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 OSThread* OSThreadIterator::Next() { 233 OSThread* OSThreadIterator::Next() {
234 ASSERT(OSThread::thread_list_lock_ != NULL); 234 ASSERT(OSThread::thread_list_lock_ != NULL);
235 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); 235 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread());
236 OSThread* current = next_; 236 OSThread* current = next_;
237 next_ = next_->thread_list_next_; 237 next_ = next_->thread_list_next_;
238 return current; 238 return current;
239 } 239 }
240 240
241 } // namespace dart 241 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698