| Index: runtime/vm/os_thread.cc
|
| diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc
|
| index f5818a25444fdab503e5c4a9f4528abf1b3834d0..ca4486af23cc6440196262bc575031905fee1bbf 100644
|
| --- a/runtime/vm/os_thread.cc
|
| +++ b/runtime/vm/os_thread.cc
|
| @@ -19,7 +19,6 @@ OSThread* OSThread::thread_list_head_ = NULL;
|
| Mutex* OSThread::thread_list_lock_ = NULL;
|
| bool OSThread::creation_enabled_ = false;
|
|
|
| -
|
| OSThread::OSThread()
|
| : BaseThread(true),
|
| id_(OSThread::GetCurrentThreadId()),
|
| @@ -39,7 +38,6 @@ OSThread::OSThread()
|
| thread_(NULL) {
|
| }
|
|
|
| -
|
| OSThread* OSThread::CreateOSThread() {
|
| ASSERT(thread_list_lock_ != NULL);
|
| MutexLocker ml(thread_list_lock_);
|
| @@ -51,7 +49,6 @@ OSThread* OSThread::CreateOSThread() {
|
| return os_thread;
|
| }
|
|
|
| -
|
| OSThread::~OSThread() {
|
| RemoveThreadFromList(this);
|
| delete log_;
|
| @@ -66,7 +63,6 @@ OSThread::~OSThread() {
|
| free(name_);
|
| }
|
|
|
| -
|
| void OSThread::SetName(const char* name) {
|
| MutexLocker ml(thread_list_lock_);
|
| // Clear the old thread name.
|
| @@ -77,13 +73,11 @@ void OSThread::SetName(const char* name) {
|
| set_name(name);
|
| }
|
|
|
| -
|
| void OSThread::DisableThreadInterrupts() {
|
| ASSERT(OSThread::Current() == this);
|
| AtomicOperations::FetchAndIncrement(&thread_interrupt_disabled_);
|
| }
|
|
|
| -
|
| void OSThread::EnableThreadInterrupts() {
|
| ASSERT(OSThread::Current() == this);
|
| uintptr_t old =
|
| @@ -100,17 +94,14 @@ void OSThread::EnableThreadInterrupts() {
|
| }
|
| }
|
|
|
| -
|
| bool OSThread::ThreadInterruptsEnabled() {
|
| return AtomicOperations::LoadRelaxed(&thread_interrupt_disabled_) == 0;
|
| }
|
|
|
| -
|
| static void DeleteThread(void* thread) {
|
| delete reinterpret_cast<OSThread*>(thread);
|
| }
|
|
|
| -
|
| void OSThread::InitOnce() {
|
| // Allocate the global OSThread lock.
|
| ASSERT(thread_list_lock_ == NULL);
|
| @@ -132,7 +123,6 @@ void OSThread::InitOnce() {
|
| os_thread->set_name("Dart_Initialize");
|
| }
|
|
|
| -
|
| void OSThread::Cleanup() {
|
| // We cannot delete the thread local key and thread list lock, yet.
|
| // See the note on thread_list_lock_ in os_thread.h.
|
| @@ -151,7 +141,6 @@ void OSThread::Cleanup() {
|
| #endif
|
| }
|
|
|
| -
|
| OSThread* OSThread::CreateAndSetUnknownThread() {
|
| ASSERT(OSThread::GetCurrentTLS() == NULL);
|
| OSThread* os_thread = CreateOSThread();
|
| @@ -162,7 +151,6 @@ OSThread* OSThread::CreateAndSetUnknownThread() {
|
| return os_thread;
|
| }
|
|
|
| -
|
| bool OSThread::IsThreadInList(ThreadId id) {
|
| if (id == OSThread::kInvalidThreadId) {
|
| return false;
|
| @@ -180,25 +168,21 @@ bool OSThread::IsThreadInList(ThreadId id) {
|
| return false;
|
| }
|
|
|
| -
|
| void OSThread::DisableOSThreadCreation() {
|
| MutexLocker ml(thread_list_lock_);
|
| creation_enabled_ = false;
|
| }
|
|
|
| -
|
| void OSThread::EnableOSThreadCreation() {
|
| MutexLocker ml(thread_list_lock_);
|
| creation_enabled_ = true;
|
| }
|
|
|
| -
|
| OSThread* OSThread::GetOSThreadFromThread(Thread* thread) {
|
| ASSERT(thread->os_thread() != NULL);
|
| return thread->os_thread();
|
| }
|
|
|
| -
|
| void OSThread::AddThreadToListLocked(OSThread* thread) {
|
| ASSERT(thread != NULL);
|
| ASSERT(thread_list_lock_ != NULL);
|
| @@ -222,7 +206,6 @@ void OSThread::AddThreadToListLocked(OSThread* thread) {
|
| thread_list_head_ = thread;
|
| }
|
|
|
| -
|
| void OSThread::RemoveThreadFromList(OSThread* thread) {
|
| bool final_thread = false;
|
| {
|
| @@ -256,12 +239,10 @@ void OSThread::RemoveThreadFromList(OSThread* thread) {
|
| }
|
| }
|
|
|
| -
|
| void OSThread::SetCurrent(OSThread* current) {
|
| OSThread::SetThreadLocal(thread_key_, reinterpret_cast<uword>(current));
|
| }
|
|
|
| -
|
| OSThreadIterator::OSThreadIterator() {
|
| ASSERT(OSThread::thread_list_lock_ != NULL);
|
| // Lock the thread list while iterating.
|
| @@ -269,21 +250,18 @@ OSThreadIterator::OSThreadIterator() {
|
| next_ = OSThread::thread_list_head_;
|
| }
|
|
|
| -
|
| OSThreadIterator::~OSThreadIterator() {
|
| ASSERT(OSThread::thread_list_lock_ != NULL);
|
| // Unlock the thread list when done.
|
| OSThread::thread_list_lock_->Unlock();
|
| }
|
|
|
| -
|
| bool OSThreadIterator::HasNext() const {
|
| ASSERT(OSThread::thread_list_lock_ != NULL);
|
| ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread());
|
| return next_ != NULL;
|
| }
|
|
|
| -
|
| OSThread* OSThreadIterator::Next() {
|
| ASSERT(OSThread::thread_list_lock_ != NULL);
|
| ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread());
|
|
|