Lines Matching refs:thread

117 bool ThreadList::Contains(Thread* thread) {  in Contains()  argument
118 return find(list_.begin(), list_.end(), thread) != list_.end(); in Contains()
128 for (const auto& thread : list_) { in DumpNativeStacks() local
129 os << "DUMPING THREAD " << thread->GetTid() << "\n"; in DumpNativeStacks()
130 DumpNativeStack(os, thread->GetTid(), map.get(), "\t"); in DumpNativeStacks()
173 Thread* thread; in DumpUnattachedThreads() local
176 thread = FindThreadByTid(tid); in DumpUnattachedThreads()
178 if (thread == nullptr) { in DumpUnattachedThreads()
205 void Run(Thread* thread) override { in Run() argument
213 thread->Dump(local_os, dump_native_stack_, backtrace_map_.get()); in Run()
270 for (const auto& thread : list_) { in AssertThreadsAreSuspended() local
271 if (thread != ignore1 && thread != ignore2) { in AssertThreadsAreSuspended()
272 CHECK(thread->IsSuspended()) in AssertThreadsAreSuspended()
273 << "\nUnsuspended thread: <<" << *thread << "\n" in AssertThreadsAreSuspended()
325 for (const auto& thread : list_) { in RunCheckpoint() local
326 if (thread != self) { in RunCheckpoint()
329 if (thread->RequestCheckpoint(checkpoint_function)) { in RunCheckpoint()
334 thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
341 if (thread->GetState() == kRunnable) { in RunCheckpoint()
347 thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
350 if (thread->IsSuspended()) { in RunCheckpoint()
357 DCHECK(thread->IsSuspended()); in RunCheckpoint()
363 suspended_count_modified_threads.push_back(thread); in RunCheckpoint()
377 for (const auto& thread : suspended_count_modified_threads) { in RunCheckpoint() local
379 DCHECK(thread->IsSuspended()); in RunCheckpoint()
380 checkpoint_function->Run(thread); in RunCheckpoint()
383 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
410 for (Thread* thread : list_) { in RunEmptyCheckpoint()
411 if (thread != self) { in RunEmptyCheckpoint()
413 if (thread->RequestEmptyCheckpoint()) { in RunEmptyCheckpoint()
418 runnable_thread_ids.push_back(thread->GetThreadId()); in RunEmptyCheckpoint()
422 if (thread->GetState() != kRunnable) { in RunEmptyCheckpoint()
478 for (Thread* thread : GetList()) { in RunEmptyCheckpoint()
479 uint32_t tid = thread->GetThreadId(); in RunEmptyCheckpoint()
484 thread->ReadFlag(kEmptyCheckpointRequest)) { in RunEmptyCheckpoint()
487 thread->Dump(LOG_STREAM(FATAL_WITHOUT_ABORT), in RunEmptyCheckpoint()
547 for (const auto& thread : list_) { in FlipThreadRoots() local
551 thread->SetFlipFunction(thread_flip_visitor); in FlipThreadRoots()
552 if (thread == self) { in FlipThreadRoots()
559 ThreadState state = thread->GetState(); in FlipThreadRoots()
560 if ((state == kWaitingForGcThreadFlip || thread->IsTransitioningToRunnable()) && in FlipThreadRoots()
561 thread->GetSuspendCount() == 1) { in FlipThreadRoots()
563 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in FlipThreadRoots()
567 other_threads.push_back(thread); in FlipThreadRoots()
579 for (const auto& thread : other_threads) { in FlipThreadRoots() local
580 Closure* flip_func = thread->GetFlipFunction(); in FlipThreadRoots()
582 flip_func->Run(thread); in FlipThreadRoots()
596 for (const auto& thread : other_threads) { in FlipThreadRoots() local
597 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in FlipThreadRoots()
697 for (const auto& thread : list_) { in SuspendAllInternal() local
698 if (thread == ignore1 || thread == ignore2) { in SuspendAllInternal()
701 VLOG(threads) << "requesting thread suspend: " << *thread; in SuspendAllInternal()
702 bool updated = thread->ModifySuspendCount(self, +1, &pending_threads, reason); in SuspendAllInternal()
708 if (thread->IsSuspended()) { in SuspendAllInternal()
710 thread->ClearSuspendBarrier(&pending_threads); in SuspendAllInternal()
738 for (const auto& thread : list_) { in SuspendAllInternal() local
739 if (thread == ignore1 || thread == ignore2) { in SuspendAllInternal()
742 if (!thread->IsSuspended()) { in SuspendAllInternal()
743 oss << std::endl << "Thread not suspended: " << *thread; in SuspendAllInternal()
792 for (const auto& thread : list_) { in ResumeAll() local
793 if (thread == self) { in ResumeAll()
796 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in ResumeAll()
817 bool ThreadList::Resume(Thread* thread, SuspendReason reason) { in Resume() argument
822 DCHECK_NE(thread, self); in Resume()
823 VLOG(threads) << "Resume(" << reinterpret_cast<void*>(thread) << ") starting..." << reason; in Resume()
830 if (UNLIKELY(!thread->IsSuspended())) { in Resume()
831 LOG(ERROR) << "Resume(" << reinterpret_cast<void*>(thread) in Resume()
835 if (!Contains(thread)) { in Resume()
838 LOG(ERROR) << "Resume(" << reinterpret_cast<void*>(thread) in Resume()
842 if (UNLIKELY(!thread->ModifySuspendCount(self, -1, nullptr, reason))) { in Resume()
843 LOG(ERROR) << "Resume(" << reinterpret_cast<void*>(thread) in Resume()
850 VLOG(threads) << "Resume(" << reinterpret_cast<void*>(thread) << ") waking others"; in Resume()
855 VLOG(threads) << "Resume(" << reinterpret_cast<void*>(thread) << ") complete"; in Resume()
888 Thread* thread; in SuspendThreadByPeer() local
897 thread = Thread::FromManagedThread(soa, peer); in SuspendThreadByPeer()
898 if (thread == nullptr) { in SuspendThreadByPeer()
916 if (!Contains(thread)) { in SuspendThreadByPeer()
919 << reinterpret_cast<void*>(thread); in SuspendThreadByPeer()
922 VLOG(threads) << "SuspendThreadByPeer found thread: " << *thread; in SuspendThreadByPeer()
934 suspended_thread = thread; in SuspendThreadByPeer()
940 CHECK_GT(thread->GetSuspendCount(), 0); in SuspendThreadByPeer()
946 CHECK_NE(thread, self) << "Attempt to suspend the current thread for the debugger"; in SuspendThreadByPeer()
950 if (thread->IsSuspended()) { in SuspendThreadByPeer()
951 VLOG(threads) << "SuspendThreadByPeer thread suspended: " << *thread; in SuspendThreadByPeer()
954 thread->GetThreadName(name); in SuspendThreadByPeer()
958 return thread; in SuspendThreadByPeer()
968 CHECK_EQ(suspended_thread, thread); in SuspendThreadByPeer()
1020 Thread* thread = nullptr; in SuspendThreadByThreadId() local
1023 thread = it; in SuspendThreadByThreadId()
1027 if (thread == nullptr) { in SuspendThreadByThreadId()
1036 VLOG(threads) << "SuspendThreadByThreadId found thread: " << *thread; in SuspendThreadByThreadId()
1037 DCHECK(Contains(thread)); in SuspendThreadByThreadId()
1047 bool updated = thread->ModifySuspendCount(self, +1, nullptr, reason); in SuspendThreadByThreadId()
1049 suspended_thread = thread; in SuspendThreadByThreadId()
1051 CHECK_EQ(suspended_thread, thread); in SuspendThreadByThreadId()
1053 CHECK_GT(thread->GetSuspendCount(), 0); in SuspendThreadByThreadId()
1059 CHECK_NE(thread, self) << "Attempt to suspend the current thread for the debugger"; in SuspendThreadByThreadId()
1063 if (thread->IsSuspended()) { in SuspendThreadByThreadId()
1066 thread->GetThreadName(name); in SuspendThreadByThreadId()
1070 VLOG(threads) << "SuspendThreadByThreadId thread suspended: " << *thread; in SuspendThreadByThreadId()
1071 return thread; in SuspendThreadByThreadId()
1079 bool updated = thread->ModifySuspendCount(soa.Self(), -1, nullptr, reason); in SuspendThreadByThreadId()
1100 for (const auto& thread : list_) { in FindThreadByThreadId() local
1101 if (thread->GetThreadId() == thread_id) { in FindThreadByThreadId()
1102 return thread; in FindThreadByThreadId()
1109 for (const auto& thread : list_) { in FindThreadByTid() local
1110 if (thread->GetTid() == tid) { in FindThreadByTid()
1111 return thread; in FindThreadByTid()
1143 for (const auto& thread : list_) { in WaitForOtherNonDaemonThreadsToExit() local
1144 if (thread != self && !thread->IsDaemon()) { in WaitForOtherNonDaemonThreadsToExit()
1166 for (const auto& thread : list_) { in SuspendAllDaemonThreadsForShutdown() local
1169 CHECK(thread->IsDaemon()) << *thread; in SuspendAllDaemonThreadsForShutdown()
1170 if (thread != self) { in SuspendAllDaemonThreadsForShutdown()
1171 bool updated = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in SuspendAllDaemonThreadsForShutdown()
1177 thread->GetJniEnv()->SetFunctionsToRuntimeShutdownFunctions(); in SuspendAllDaemonThreadsForShutdown()
1203 for (const auto& thread : list_) { in SuspendAllDaemonThreadsForShutdown() local
1204 if (thread != self && thread->GetState() == kRunnable) { in SuspendAllDaemonThreadsForShutdown()
1206 LOG(WARNING) << "daemon thread not yet suspended: " << *thread; in SuspendAllDaemonThreadsForShutdown()
1238 for (const auto& thread : list_) { in SuspendAllDaemonThreadsForShutdown() local
1239 DCHECK(thread == self || !all_suspended || thread->GetState() != kRunnable); in SuspendAllDaemonThreadsForShutdown()
1241 thread->GetJniEnv()->SetRuntimeDeleted(); in SuspendAllDaemonThreadsForShutdown()
1365 for (const auto& thread : list_) { in ForEach() local
1366 callback(thread, context); in ForEach()
1378 for (Thread* thread : list_) { in VisitRootsForSuspendedThreads()
1379 bool suspended = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1381 if (thread == self || thread->IsSuspended()) { in VisitRootsForSuspendedThreads()
1382 threads_to_visit.push_back(thread); in VisitRootsForSuspendedThreads()
1384 bool resumed = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1392 for (Thread* thread : threads_to_visit) { in VisitRootsForSuspendedThreads()
1393 thread->VisitRoots(visitor, kVisitRootFlagAllRoots); in VisitRootsForSuspendedThreads()
1399 for (Thread* thread : threads_to_visit) { in VisitRootsForSuspendedThreads()
1400 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1408 for (const auto& thread : list_) { in VisitRoots() local
1409 thread->VisitRoots(visitor, flags); in VisitRoots()
1415 for (const auto& thread : list_) { in SweepInterpreterCaches() local
1416 thread->SweepInterpreterCache(visitor); in SweepInterpreterCaches()
1422 for (const auto& thread : list_) { in VisitReflectiveTargets() local
1423 thread->VisitReflectiveTargets(visitor); in VisitReflectiveTargets()