OLD | NEW |
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 #include "vm/timeline.h" | 11 #include "vm/timeline.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 // The single thread local key which stores all the thread local data | 15 // The single thread local key which stores all the thread local data |
16 // for a thread. | 16 // for a thread. |
17 ThreadLocalKey OSThread::thread_key_ = kUnsetThreadLocalKey; | 17 ThreadLocalKey OSThread::thread_key_ = kUnsetThreadLocalKey; |
18 OSThread* OSThread::thread_list_head_ = NULL; | 18 OSThread* OSThread::thread_list_head_ = NULL; |
19 Mutex* OSThread::thread_list_lock_ = NULL; | 19 Mutex* OSThread::thread_list_lock_ = NULL; |
20 bool OSThread::creation_enabled_ = false; | 20 bool OSThread::creation_enabled_ = false; |
21 | 21 |
22 | 22 |
23 OSThread::OSThread() : | 23 OSThread::OSThread() : |
24 BaseThread(true), | 24 BaseThread(true), |
25 id_(OSThread::GetCurrentThreadId()), | 25 id_(OSThread::GetCurrentThreadId()), |
26 #if defined(DEBUG) | 26 #if defined(DEBUG) |
27 join_id_(kInvalidThreadJoinId), | 27 join_id_(kInvalidThreadJoinId), |
28 #endif | 28 #endif |
| 29 #ifndef PRODUCT |
29 trace_id_(OSThread::GetCurrentThreadTraceId()), | 30 trace_id_(OSThread::GetCurrentThreadTraceId()), |
| 31 #endif |
30 name_(NULL), | 32 name_(NULL), |
31 timeline_block_lock_(new Mutex()), | 33 timeline_block_lock_(new Mutex()), |
32 timeline_block_(NULL), | 34 timeline_block_(NULL), |
33 thread_list_next_(NULL), | 35 thread_list_next_(NULL), |
34 thread_interrupt_disabled_(1), // Thread interrupts disabled by default. | 36 thread_interrupt_disabled_(1), // Thread interrupts disabled by default. |
35 log_(new class Log()), | 37 log_(new class Log()), |
36 stack_base_(0), | 38 stack_base_(0), |
37 thread_(NULL) { | 39 thread_(NULL) { |
38 } | 40 } |
39 | 41 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 287 |
286 OSThread* OSThreadIterator::Next() { | 288 OSThread* OSThreadIterator::Next() { |
287 ASSERT(OSThread::thread_list_lock_ != NULL); | 289 ASSERT(OSThread::thread_list_lock_ != NULL); |
288 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); | 290 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); |
289 OSThread* current = next_; | 291 OSThread* current = next_; |
290 next_ = next_->thread_list_next_; | 292 next_ = next_->thread_list_next_; |
291 return current; | 293 return current; |
292 } | 294 } |
293 | 295 |
294 } // namespace dart | 296 } // namespace dart |
OLD | NEW |