| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 if (old == 0) { | 97 if (old == 0) { |
| 98 // We just decremented from 0, this means we've got a mismatched pair | 98 // We just decremented from 0, this means we've got a mismatched pair |
| 99 // of calls to EnableThreadInterrupts and DisableThreadInterrupts. | 99 // of calls to EnableThreadInterrupts and DisableThreadInterrupts. |
| 100 FATAL("Invalid call to OSThread::EnableThreadInterrupts()"); | 100 FATAL("Invalid call to OSThread::EnableThreadInterrupts()"); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 bool OSThread::ThreadInterruptsEnabled() { | 105 bool OSThread::ThreadInterruptsEnabled() { |
| 106 return AtomicOperations::LoadAcquire(&thread_interrupt_disabled_) == 0; | 106 return AtomicOperations::LoadRelaxed(&thread_interrupt_disabled_) == 0; |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 static void DeleteThread(void* thread) { | 110 static void DeleteThread(void* thread) { |
| 111 delete reinterpret_cast<OSThread*>(thread); | 111 delete reinterpret_cast<OSThread*>(thread); |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 void OSThread::InitOnce() { | 115 void OSThread::InitOnce() { |
| 116 // Allocate the global OSThread lock. | 116 // Allocate the global OSThread lock. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 OSThread* OSThreadIterator::Next() { | 288 OSThread* OSThreadIterator::Next() { |
| 289 ASSERT(OSThread::thread_list_lock_ != NULL); | 289 ASSERT(OSThread::thread_list_lock_ != NULL); |
| 290 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); | 290 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); |
| 291 OSThread* current = next_; | 291 OSThread* current = next_; |
| 292 next_ = next_->thread_list_next_; | 292 next_ = next_->thread_list_next_; |
| 293 return current; | 293 return current; |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace dart | 296 } // namespace dart |
| OLD | NEW |