fix(kernel): let a pending HRTIMER wake a blocking equeue wait #1081

Closed
Woesch-Nich wants to merge 1 commit from upstream-pr/1081 into main
Woesch-Nich commented 2026-10-07 09:49:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Woesch-Nich on 2026-10-07T09:49:28Z.


Problem

SceKernelWaitEqueue with micros == 0 (infinite wait) parked forever in m_cond.Wait() even when a one-shot high-resolution timer was pending: the pending expiry was only consulted in the timed branch. A blocking consumer on its timer queue (observed in a real game's dispatcher thread) never woke when its own timer fired.

Fix

Mirror the timed branch: if NextTimerWaitMicros() reports a pending expiry, wait until that deadline instead of blocking indefinitely; fall back to Wait() when no timer is pending (no behavior change in that case).

Testing

Verified in-conversation on a Windows host running the game under the AnyPS5 relinker: the dispatcher thread that previously parked for the whole session now wakes on its HRTIMER expiry; the full thread roster comes up.

Related: #807 (adriadam10) touches the producer side (sceKernelAddTimerEvent/DeleteTimerEvent); this is the consumer-side half.


Attribution: this fix was entirely written by Qwen 3.8 27b (in-conversation coding agent) and supervised by Claude.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4770890603 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1081). Originally posted by [Woesch-Nich](https://github.com/Woesch-Nich) on 2026-10-07T09:49:28Z. --- ## Problem `SceKernelWaitEqueue` with `micros == 0` (infinite wait) parked forever in `m_cond.Wait()` even when a one-shot high-resolution timer was pending: the pending expiry was only consulted in the timed branch. A blocking consumer on its timer queue (observed in a real game's dispatcher thread) never woke when its own timer fired. ## Fix Mirror the timed branch: if `NextTimerWaitMicros()` reports a pending expiry, wait until that deadline instead of blocking indefinitely; fall back to `Wait()` when no timer is pending (no behavior change in that case). ## Testing Verified in-conversation on a Windows host running the game under the AnyPS5 relinker: the dispatcher thread that previously parked for the whole session now wakes on its HRTIMER expiry; the full thread roster comes up. Related: #807 (adriadam10) touches the producer side (`sceKernelAddTimerEvent`/`DeleteTimerEvent`); this is the consumer-side half. --- *Attribution: this fix was entirely written by **Qwen 3.8 27b** (in-conversation coding agent) and **supervised by Claude**.*
oneandonlydean commented 2026-10-08 02:44:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T02:44:07Z.


Closing: main already does this since #807, which makes the infinite wait in Equeue.cpp wake at the pending timer's deadline. If a title still parks there on current main, please comment here with the title ID and the log line where it stops.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051101057 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1081#issuecomment-6051101057). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T02:44:07Z. --- Closing: main already does this since #807, which makes the infinite wait in `Equeue.cpp` wake at the pending timer's deadline. If a title still parks there on current main, please comment here with the title ID and the log line where it stops.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1081
No description provided.