diff options
author | 2023-12-19 18:48:15 +0000 | |
---|---|---|
committer | 2023-12-19 20:32:27 +0000 | |
commit | 8bc6a58df7046b4d6f4b51eb274c7e60fea396ff (patch) | |
tree | ac6aa639279f5cf2048cb147a91cbea98c8088a4 /runtime/gc/task_processor.cc | |
parent | ee7471ec0a7aba338c3ac90de0f2ef0be9a35fed (diff) |
Revert^17 "Thread suspension cleanup and deadlock fix"
This reverts commit c6371b52df0da31acc174a3526274417b7aac0a7.
Reason for revert: This seems to have two remaining issues:
1. The second DCHECK in WaitForFlipFunction is not completely guaranteed to hold, resulting in failures for 658-fp-read-barrier.
2. WaitForSuspendBarrier seems to time out occasionally, possibly spuriously so. We fail when the futex times out once. That's probably incompatible with the app freezer. We should retry a few times.
Change-Id: Ibd8909b31083fc29e6d4f1fcde003d08eb16fc0a
Diffstat (limited to 'runtime/gc/task_processor.cc')
-rw-r--r-- | runtime/gc/task_processor.cc | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/runtime/gc/task_processor.cc b/runtime/gc/task_processor.cc index e56dbd17c3..494cf2bb79 100644 --- a/runtime/gc/task_processor.cc +++ b/runtime/gc/task_processor.cc @@ -103,31 +103,9 @@ bool TaskProcessor::IsRunning() const { return is_running_; } -bool TaskProcessor::WaitForThread(Thread* self) { - // Waiting for too little time here may cause us to fail to get stack traces, since we can't - // safely do so without identifying a HeapTaskDaemon to avoid it. Waiting too long could - // conceivably deadlock if we somehow try to get a stack trace on the way to starting the - // HeapTaskDaemon. Under normal circumstances. this should terminate immediately, since - // HeapTaskDaemon should normally be running. - constexpr int kTotalWaitMillis = 100; - for (int i = 0; i < kTotalWaitMillis; ++i) { - if (is_running_) { - return true; - } - cond_.TimedWait(self, 1 /*msecs*/, 0 /*nsecs*/); - } - LOG(ERROR) << "No identifiable HeapTaskDaemon; unsafe to get thread stacks."; - return false; -} - -bool TaskProcessor::IsRunningThread(Thread* t, bool wait) { - Thread* self = Thread::Current(); - MutexLock mu(self, lock_); - if (wait && !WaitForThread(self)) { - // If Wait failed, either answer may be correct; in our case, true is safer. - return true; - } - return running_thread_ == t; +Thread* TaskProcessor::GetRunningThread() const { + MutexLock mu(Thread::Current(), lock_); + return running_thread_; } void TaskProcessor::Stop(Thread* self) { |