| 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (Timeline::recorder() != NULL) { | 56 if (Timeline::recorder() != NULL) { |
| 57 Timeline::recorder()->FinishBlock(timeline_block_); | 57 Timeline::recorder()->FinishBlock(timeline_block_); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 timeline_block_ = NULL; | 60 timeline_block_ = NULL; |
| 61 delete timeline_block_lock_; | 61 delete timeline_block_lock_; |
| 62 free(name_); | 62 free(name_); |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 |
| 67 void OSThread::SetName(const char* name) { |
| 68 MutexLocker ml(thread_list_lock_); |
| 69 // Clear the old thread name. |
| 70 if (name_ != NULL) { |
| 71 free(name_); |
| 72 name_ = NULL; |
| 73 } |
| 74 set_name(name); |
| 75 } |
| 76 |
| 77 |
| 66 void OSThread::DisableThreadInterrupts() { | 78 void OSThread::DisableThreadInterrupts() { |
| 67 ASSERT(OSThread::Current() == this); | 79 ASSERT(OSThread::Current() == this); |
| 68 AtomicOperations::FetchAndIncrement(&thread_interrupt_disabled_); | 80 AtomicOperations::FetchAndIncrement(&thread_interrupt_disabled_); |
| 69 } | 81 } |
| 70 | 82 |
| 71 | 83 |
| 72 void OSThread::EnableThreadInterrupts() { | 84 void OSThread::EnableThreadInterrupts() { |
| 73 ASSERT(OSThread::Current() == this); | 85 ASSERT(OSThread::Current() == this); |
| 74 uintptr_t old = | 86 uintptr_t old = |
| 75 AtomicOperations::FetchAndDecrement(&thread_interrupt_disabled_); | 87 AtomicOperations::FetchAndDecrement(&thread_interrupt_disabled_); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 283 |
| 272 OSThread* OSThreadIterator::Next() { | 284 OSThread* OSThreadIterator::Next() { |
| 273 ASSERT(OSThread::thread_list_lock_ != NULL); | 285 ASSERT(OSThread::thread_list_lock_ != NULL); |
| 274 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); | 286 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); |
| 275 OSThread* current = next_; | 287 OSThread* current = next_; |
| 276 next_ = next_->thread_list_next_; | 288 next_ = next_->thread_list_next_; |
| 277 return current; | 289 return current; |
| 278 } | 290 } |
| 279 | 291 |
| 280 } // namespace dart | 292 } // namespace dart |
| OLD | NEW |