From 17195424dd56070a773e82ab5430c788e54a78c6 Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Tue, 19 Dec 2023 20:35:24 +0000 Subject: Revert^18 "Thread suspension cleanup and deadlock fix" This reverts commit 8bc6a58df7046b4d6f4b51eb274c7e60fea396ff. PS1 is identical to https://android-review.git.corp.google.com/c/platform/art/+/2746640 PS2 makes the following changes: - Remove one DCHECK each from the two WaitForFlipFunction variants. The DCHECK could fail if another GC was started in the interim. - Break up the WaitForSuspendBarrier timeout into shorter ones. so we don't time out as easily if our process is frozen. - Include the thread name for ThreadSuspendByThreadIdWarning, since we don't get complete tombstones for some failures. Test: Treehugger, host tests. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 Bug: 295880862 Bug: 294334417 Bug: 301090887 Bug: 313347640 (and more) Change-Id: I12c5c01b1e006baab4ee4148aadbc721723fb89e --- runtime/gc/task_processor.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime/gc/task_processor.h') diff --git a/runtime/gc/task_processor.h b/runtime/gc/task_processor.h index 86e36ab6d6..b9e6938b09 100644 --- a/runtime/gc/task_processor.h +++ b/runtime/gc/task_processor.h @@ -64,9 +64,15 @@ class TaskProcessor { bool IsRunning() const REQUIRES(!lock_); void UpdateTargetRunTime(Thread* self, HeapTask* target_time, uint64_t new_target_time) REQUIRES(!lock_); - Thread* GetRunningThread() const REQUIRES(!lock_); + // Is the given thread the task processor thread? + // If wait is true, and no thread has been registered via Start(), we briefly + // wait for one to be registered. If we time out, we return true. + bool IsRunningThread(Thread* t, bool wait = false) REQUIRES(!lock_); private: + // Wait briefly for running_thread_ to become non-null. Return false on timeout. + bool WaitForThread(Thread* self) REQUIRES(lock_); + class CompareByTargetRunTime { public: bool operator()(const HeapTask* a, const HeapTask* b) const { -- cgit v1.2.3-59-g8ed1b