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

Unified Diff: runtime/vm/thread.cc

Issue 1425463004: Fix ThreadIterator_AddFindRemove test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index a2af102a7ebc4736a645e2fd800e2c5b4ef5aa8a..1e02047a1846824ae2ab2fd86f95ab7b8bdd76f9 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -101,6 +101,23 @@ void Thread::RemoveThreadFromList(Thread* thread) {
}
+bool Thread::IsThreadInList(ThreadId join_id) {
+ if (join_id == OSThread::kInvalidThreadJoinId) {
+ return false;
+ }
+ ThreadIterator it;
+ while (it.HasNext()) {
+ Thread* t = it.Next();
+ // An address test is not sufficient because the allocator may recycle
+ // the address for another Thread. Test against the thread's join id.
+ if (t->join_id() == join_id) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
static void DeleteThread(void* thread) {
delete reinterpret_cast<Thread*>(thread);
}
@@ -178,6 +195,7 @@ void Thread::EnsureInit() {
Thread::Thread(bool init_vm_constants)
: id_(OSThread::GetCurrentThreadId()),
+ join_id_(OSThread::GetCurrentThreadJoinId()),
thread_interrupt_callback_(NULL),
thread_interrupt_data_(NULL),
isolate_(NULL),
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698