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

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

Issue 1483113002: Thread and Timeline fixes for Mojo. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Cleanup 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
« no previous file with comments | « runtime/vm/os_thread.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 thread_key_ = kUnsetThreadLocalKey; 107 thread_key_ = kUnsetThreadLocalKey;
108 108
109 // Delete the global OSThread lock. 109 // Delete the global OSThread lock.
110 ASSERT(thread_list_lock_ != NULL); 110 ASSERT(thread_list_lock_ != NULL);
111 delete thread_list_lock_; 111 delete thread_list_lock_;
112 thread_list_lock_ = NULL; 112 thread_list_lock_ = NULL;
113 } 113 }
114 } 114 }
115 115
116 116
117 bool OSThread::IsThreadInList(ThreadId join_id) { 117 OSThread* OSThread::CreateAndSetUnknownThread() {
118 ASSERT(OSThread::Current() == NULL);
119 OSThread* os_thread = new OSThread();
120 OSThread::SetCurrent(os_thread);
121 os_thread->set_name("Unknown");
122 return os_thread;
123 }
124
125
126 bool OSThread::IsThreadInList(ThreadJoinId join_id) {
118 if (join_id == OSThread::kInvalidThreadJoinId) { 127 if (join_id == OSThread::kInvalidThreadJoinId) {
119 return false; 128 return false;
120 } 129 }
121 OSThreadIterator it; 130 OSThreadIterator it;
122 while (it.HasNext()) { 131 while (it.HasNext()) {
123 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); 132 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread());
124 OSThread* t = it.Next(); 133 OSThread* t = it.Next();
125 // An address test is not sufficient because the allocator may recycle 134 // An address test is not sufficient because the allocator may recycle
126 // the address for another Thread. Test against the thread's join id. 135 // the address for another Thread. Test against the thread's join id.
127 if (t->join_id() == join_id) { 136 if (t->join_id() == join_id) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 232
224 OSThread* OSThreadIterator::Next() { 233 OSThread* OSThreadIterator::Next() {
225 ASSERT(OSThread::thread_list_lock_ != NULL); 234 ASSERT(OSThread::thread_list_lock_ != NULL);
226 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); 235 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread());
227 OSThread* current = next_; 236 OSThread* current = next_;
228 next_ = next_->thread_list_next_; 237 next_ = next_->thread_list_next_;
229 return current; 238 return current;
230 } 239 }
231 240
232 } // namespace dart 241 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/os_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698