fix(libkernel): give each nested TimedWait its own waiter on Windows #1476

Merged
awake-devel merged 1 commit from upstream-pr/1476 into main 2026-10-08 14:48:48 +00:00
awake-devel commented 2026-10-08 08:49:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by awake-devel on 2026-10-08T08:49:12Z.


⚠️ Needs testing on Windows before merge. This change was not built or run on Windows: the author has no Windows machine. Please test it on Windows (build and full ctest) before merging.

What

On Windows, a sceKernelRaiseException handler that waits could lose wakeups for the thread it interrupted and for other threads.

Each thread had one TimedWait waiter (an event, a timer and the queue links) and used it for every wait. A raise on a thread that is blocked in a TimedWait condition runs the handler as an APC inside that wait (#760), while the waiter is still linked into the condition's queue. If the handler waits too (sceKernelSyncOnAddressWait, a semaphore, a contended mutex), Condition::enqueue reused that waiter and overwrote its links:

  • The first queue lost every waiter behind it. A later NotifyAll there woke only the interrupted thread, and the others slept until their timeout or forever.
  • A wake of the outer wait while the handler was waiting set the shared event; the handler's wait consumed it, and the outer wait never returned.
  • A queue could keep a pointer to a waiter that was later freed with its thread.

A wait now takes the thread's first waiter that is not in use, and creates a deeper one for a wait nested inside another. Each waiter keeps its own event and timer; the nested ones are freed with the thread's first waiter. Linux is unchanged: its TimedWait::Condition is a std::condition_variable_any and sceKernelRaiseException throws there.

This PR was investigated and written by Claude Code (AI), and posted by me after review.

Tested

Not built or run on Windows: no Windows machine was available. Every changed line is Windows-only (TimedWait.cpp inside #ifdef _WIN32, and guest_raise_exception, which is registered only on Windows).

Linux (Arch Linux, GCC, i7 laptop): the preprocessed TimedWait.cpp (g++ -std=c++20 -E -P) is byte-identical before and after this change, so the Linux build and test suite are unaffected. The Windows code was not compiled.

New phases in guest_raise_exception (the handler waits in sceKernelSyncOnAddressWait), not yet run; on main both are expected to fail, the first by a thread that never returns from sceKernelWaitSema, the second by the interrupted thread never returning:

  • Two threads wait on a semaphore; a raise on the first runs a handler whose wait times out; then the semaphore is signaled twice. Both threads must return.
  • One thread waits on a semaphore; a raise runs a handler that waits 1 s; the semaphore is signaled during that wait. The handler's wait must time out and the thread must return.

No title tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

https://claude.ai/code/session_01HeC9bA3n74TzJRYv9AgBE8

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4784244891 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476). Originally posted by [awake-devel](https://github.com/awake-devel) on 2026-10-08T08:49:12Z. --- > ⚠️ **Needs testing on Windows before merge.** This change was not built or run on Windows: the author has no Windows machine. Please test it on Windows (build and full ctest) before merging. ### What On Windows, a `sceKernelRaiseException` handler that waits could lose wakeups for the thread it interrupted and for other threads. Each thread had one `TimedWait` waiter (an event, a timer and the queue links) and used it for every wait. A raise on a thread that is blocked in a `TimedWait` condition runs the handler as an APC inside that wait ([#760](https://github.com/boykopovar/AnyPS5/pull/760)), while the waiter is still linked into the condition's queue. If the handler waits too (`sceKernelSyncOnAddressWait`, a semaphore, a contended mutex), `Condition::enqueue` reused that waiter and overwrote its links: - The first queue lost every waiter behind it. A later `NotifyAll` there woke only the interrupted thread, and the others slept until their timeout or forever. - A wake of the outer wait while the handler was waiting set the shared event; the handler's wait consumed it, and the outer wait never returned. - A queue could keep a pointer to a waiter that was later freed with its thread. A wait now takes the thread's first waiter that is not in use, and creates a deeper one for a wait nested inside another. Each waiter keeps its own event and timer; the nested ones are freed with the thread's first waiter. Linux is unchanged: its `TimedWait::Condition` is a `std::condition_variable_any` and `sceKernelRaiseException` throws there. This PR was investigated and written by Claude Code (AI), and posted by me after review. ### Tested Not built or run on Windows: no Windows machine was available. Every changed line is Windows-only (`TimedWait.cpp` inside `#ifdef _WIN32`, and `guest_raise_exception`, which is registered only on Windows). Linux (Arch Linux, GCC, i7 laptop): the preprocessed `TimedWait.cpp` (`g++ -std=c++20 -E -P`) is byte-identical before and after this change, so the Linux build and test suite are unaffected. The Windows code was not compiled. New phases in `guest_raise_exception` (the handler waits in `sceKernelSyncOnAddressWait`), not yet run; on `main` both are expected to fail, the first by a thread that never returns from `sceKernelWaitSema`, the second by the interrupted thread never returning: - Two threads wait on a semaphore; a raise on the first runs a handler whose wait times out; then the semaphore is signaled twice. Both threads must return. - One thread waits on a semaphore; a raise runs a handler that waits 1 s; the semaphore is signaled during that wait. The handler's wait must time out and the thread must return. No title tested. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HeC9bA3n74TzJRYv9AgBE8
github-actions[bot] commented 2026-10-08 09:00:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T09:00:03Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1431 core/libs/tests/GuestRaiseException.cpp L21
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6056423503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476#issuecomment-6056423503). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T09:00:03Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1431 | `core/libs/tests/GuestRaiseException.cpp` [L21](https://github.com/boykopovar/AnyPS5/blob/29e533aca0488f99738d0ca721f42dff614fcaee/core/libs/tests/GuestRaiseException.cpp#L21) | | |
popcoder565 commented 2026-10-08 09:43:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-08T09:43:59Z.


Tested on Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release build, Intel Core i7-12700H.

This PR merged onto main 3e32797c

  • It builds.
  • guest_raise_exception, 7 runs: 5 passed, including both new phases, and 2 timed out.
    • One timeout hung in the busy-thread phase (only the first thread had started). That phase hangs on main without this PR too; it is the lost-delivery bug #1421 fixes.
    • I didn't capture which phase the other timeout hung in.
  • Mutation check (TimedWait.cpp put back to main, test kept): 2 of 5 runs hung in NestedWaitKeepsLaterWaiters (7 threads started). The other 3 hung in the busy-thread phase.
  • Full ctest: 425 of 426 pass. The failure is agc_driver_srgb8_color_target (#1434, an NVIDIA import flake).

Together with #1421 (merged cleanly)

  • ctest -R ^guest_raise_exception$ --repeat until-fail:20: 20 of 20 pass, 9.4 to 10.1 s each.
  • Mutation check:
    • All 4 runs hang in NestedWaitKeepsLaterWaiters (9 threads started).
    • With that phase removed, NestedWaitKeepsOuterWake hangs in all 3 runs (8 threads started).
    • With this PR, both phases pass.
    • These failures show up as ctest timeouts, not Require failures. ExpectReturned tries 5000 times with sleep_for(1 ms), and each step takes 15.6 ms on Windows (#1471), so it outlasts the 30 s timeout.

The same bug in TimedWait's sleeps

  • Mechanism:
    • SleepUntil, PollSleepUntil and SleepNanosCoarse each keep one thread_local timer and wait on it through TimerWait.
    • A handler that sleeps while the thread it interrupted is also sleeping re-arms the outer sleep's timer.
    • The handler's own wait then consumes the signal, because it is a synchronization timer.
    • So the interrupted sleep never returns.
  • Test: a phase where a thread sleeps in sceKernelUsleep(1000000) and is raised, with a handler that sleeps in sceKernelUsleep(20000). With this PR and #1421 it fails on every run. The handler runs once, but the 1 s sleep has not returned several seconds later, and the thread is still in its wait.
  • Fix: give a nested TimerWait its own timer. With that, it passed 3 of 3 runs, and the 1 s sleep returned after 1000.0 to 1000.2 ms:
bool TimerWait(HANDLE timer, std::uint64_t nanos) {
    thread_local int depth = 0;
    struct Nesting {
        HANDLE own;
        explicit Nesting(bool nested) : own(nested ? CreateHighResolutionTimer() : nullptr) { ++depth; }
        ~Nesting() {
            --depth;
            if (own) CloseHandle(own);
        }
    } nesting(depth != 0);
    if (depth > 1) timer = nesting.own;
    if (!timer) return false;
    // ... unchanged
The test phase I used
static std::atomic<int> sleepingCalls{0};

static void APS5_VABI SleepingHandler(int signum, void*) {
    Require(signum == SIGUSR1);
    Require(sceKernelUsleep(20000) == 0);
    sleepingCalls.fetch_add(1);
}

struct Sleeper {
    std::atomic<bool> started{false};
    std::atomic<bool> returned{false};
};

static void* APS5_VABI SleepOnce(void* arg) {
    auto& sleeper = *static_cast<Sleeper*>(arg);
    sleeper.started.store(true);
    Require(sceKernelUsleep(1000000) == 0);
    sleeper.returned.store(true);
    return nullptr;
}

static void NestedSleepKeepsOuterSleep() {
    Sleeper sleeper;
    Pthread thread = nullptr;
    Require(scePthreadCreate(&thread, nullptr, SleepOnce, &sleeper, "nested sleep") == 0);
    while (!sleeper.started.load()) std::this_thread::yield();
    std::this_thread::sleep_for(std::chrono::milliseconds(50));
    const int before = sleepingCalls.load();
    Require(sceKernelRaiseException(thread, SIGUSR1) == 0);
    for (int attempt = 0; attempt < 200 && sleepingCalls.load() == before; ++attempt) std::this_thread::sleep_for(std::chrono::milliseconds(1));
    Require(sleepingCalls.load() == before + 1);
    for (int attempt = 0; attempt < 300 && !sleeper.returned.load(); ++attempt) std::this_thread::sleep_for(std::chrono::milliseconds(1));
    Require(sleeper.returned.load());
    Require(scePthreadJoin(thread, nullptr) == 0);
}

It runs with SleepingHandler installed, after the nested-wait phases. sceKernelUsleep is declared like the other imports; with the unpatched libraries the test links against, the symbol is sceKernelUsleep_nid_postfix.

This is the same kind of bug this PR fixes, in a different path, so it could go here. If you'd rather keep this PR as it is, I can send the fix and the phase as a separate PR.

Tested with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6057135176 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476#issuecomment-6057135176). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-08T09:43:59Z. --- Tested on Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release build, Intel Core i7-12700H. ### This PR merged onto `main` 3e32797c - It builds. - `guest_raise_exception`, 7 runs: 5 passed, including both new phases, and 2 timed out. - One timeout hung in the busy-thread phase (only the first thread had started). That phase hangs on `main` without this PR too; it is the lost-delivery bug #1421 fixes. - I didn't capture which phase the other timeout hung in. - Mutation check (`TimedWait.cpp` put back to `main`, test kept): 2 of 5 runs hung in `NestedWaitKeepsLaterWaiters` (7 threads started). The other 3 hung in the busy-thread phase. - Full ctest: 425 of 426 pass. The failure is `agc_driver_srgb8_color_target` (#1434, an NVIDIA import flake). ### Together with #1421 (merged cleanly) - `ctest -R ^guest_raise_exception$ --repeat until-fail:20`: 20 of 20 pass, 9.4 to 10.1 s each. - Mutation check: - All 4 runs hang in `NestedWaitKeepsLaterWaiters` (9 threads started). - With that phase removed, `NestedWaitKeepsOuterWake` hangs in all 3 runs (8 threads started). - With this PR, both phases pass. - These failures show up as ctest timeouts, not `Require` failures. `ExpectReturned` tries 5000 times with `sleep_for(1 ms)`, and each step takes 15.6 ms on Windows (#1471), so it outlasts the 30 s timeout. ### The same bug in `TimedWait`'s sleeps - **Mechanism:** - `SleepUntil`, `PollSleepUntil` and `SleepNanosCoarse` each keep one `thread_local` timer and wait on it through `TimerWait`. - A handler that sleeps while the thread it interrupted is also sleeping re-arms the outer sleep's timer. - The handler's own wait then consumes the signal, because it is a synchronization timer. - So the interrupted sleep never returns. - **Test:** a phase where a thread sleeps in `sceKernelUsleep(1000000)` and is raised, with a handler that sleeps in `sceKernelUsleep(20000)`. With this PR and #1421 it fails on every run. The handler runs once, but the 1 s sleep has not returned several seconds later, and the thread is still in its wait. - **Fix:** give a nested `TimerWait` its own timer. With that, it passed 3 of 3 runs, and the 1 s sleep returned after 1000.0 to 1000.2 ms: ```cpp bool TimerWait(HANDLE timer, std::uint64_t nanos) { thread_local int depth = 0; struct Nesting { HANDLE own; explicit Nesting(bool nested) : own(nested ? CreateHighResolutionTimer() : nullptr) { ++depth; } ~Nesting() { --depth; if (own) CloseHandle(own); } } nesting(depth != 0); if (depth > 1) timer = nesting.own; if (!timer) return false; // ... unchanged ``` <details> <summary>The test phase I used</summary> ```cpp static std::atomic<int> sleepingCalls{0}; static void APS5_VABI SleepingHandler(int signum, void*) { Require(signum == SIGUSR1); Require(sceKernelUsleep(20000) == 0); sleepingCalls.fetch_add(1); } struct Sleeper { std::atomic<bool> started{false}; std::atomic<bool> returned{false}; }; static void* APS5_VABI SleepOnce(void* arg) { auto& sleeper = *static_cast<Sleeper*>(arg); sleeper.started.store(true); Require(sceKernelUsleep(1000000) == 0); sleeper.returned.store(true); return nullptr; } static void NestedSleepKeepsOuterSleep() { Sleeper sleeper; Pthread thread = nullptr; Require(scePthreadCreate(&thread, nullptr, SleepOnce, &sleeper, "nested sleep") == 0); while (!sleeper.started.load()) std::this_thread::yield(); std::this_thread::sleep_for(std::chrono::milliseconds(50)); const int before = sleepingCalls.load(); Require(sceKernelRaiseException(thread, SIGUSR1) == 0); for (int attempt = 0; attempt < 200 && sleepingCalls.load() == before; ++attempt) std::this_thread::sleep_for(std::chrono::milliseconds(1)); Require(sleepingCalls.load() == before + 1); for (int attempt = 0; attempt < 300 && !sleeper.returned.load(); ++attempt) std::this_thread::sleep_for(std::chrono::milliseconds(1)); Require(sleeper.returned.load()); Require(scePthreadJoin(thread, nullptr) == 0); } ``` It runs with `SleepingHandler` installed, after the nested-wait phases. `sceKernelUsleep` is declared like the other imports; with the unpatched libraries the test links against, the symbol is `sceKernelUsleep_nid_postfix`. </details> This is the same kind of bug this PR fixes, in a different path, so it could go here. If you'd rather keep this PR as it is, I can send the fix and the phase as a separate PR. Tested with AI assistance (Claude Code).
hikazey commented 2026-10-08 10:24:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T10:24:25Z.


A second Windows machine, AMD this time: Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7, the CI build), Release, configured like CI, Ryzen 9 5900X (12 cores / 24 threads). This commit merged onto main 73ac9ef7, which merges cleanly, and without #1421.

build guest_raise_exception
this PR 6/6 passed, both new phases included
TimedWait.cpp from main, new phases kept 6/6 timed out (30 s test timeout)
full suite with this PR 429/429 passed (main alone: 429/429)

The busy-thread hang seen on the i7-12700H (the lost delivery #1421 fixes) didn't happen in any of the 6 runs with this PR here. It may be timing-dependent, so 6 clean runs don't rule it out on this machine. I didn't capture which phase each mutation run hung in, only that all 6 hit the timeout.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6057810111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476#issuecomment-6057810111). Originally posted by [hikazey](https://github.com/hikazey) on 2026-10-08T10:24:25Z. --- A second Windows machine, AMD this time: Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7, the CI build), Release, configured like CI, Ryzen 9 5900X (12 cores / 24 threads). This commit merged onto `main` `73ac9ef7`, which merges cleanly, and without #1421. | build | `guest_raise_exception` | | --- | --- | | this PR | 6/6 passed, both new phases included | | `TimedWait.cpp` from `main`, new phases kept | 6/6 timed out (30 s test timeout) | | full suite with this PR | 429/429 passed (`main` alone: 429/429) | The busy-thread hang seen on the i7-12700H (the lost delivery #1421 fixes) didn't happen in any of the 6 runs with this PR here. It may be timing-dependent, so 6 clean runs don't rule it out on this machine. I didn't capture which phase each mutation run hung in, only that all 6 hit the timeout. AI-assisted: yes (Claude Code).
popcoder565 commented 2026-10-08 11:02:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-08T11:02:00Z.


I've sent the nested-sleep fix as #1520, with its test in a separate file so it doesn't collide with the phases here. If you'd rather fold it into this PR, say so and I'll close #1520.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6058428148 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476#issuecomment-6058428148). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-08T11:02:00Z. --- I've sent the nested-sleep fix as #1520, with its test in a separate file so it doesn't collide with the phases here. If you'd rather fold it into this PR, say so and I'll close #1520.
merwie commented 2026-10-08 12:43:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-08T12:43:08Z.


Tested on Windows 11 Pro 26200, WinLibs GCC 15.2.0 (r7), Release, at 39c3d045:

  • Builds without warnings in the changed files.
  • guest_raise_exception: passes 3 of 3 runs (8.4 s). With TimedWait.cpp from the merge base and the new test kept, it hits the 30 s ctest timeout 2 of 2 times, so the new phases fail without the change as expected.
  • ctest -j8 -E "agc_driver|graphics": 254/254 passed.
  • An extra check that matches what I saw in a title: one thread blocked in sceKernelWaitSema with no timeout, a raise whose handler loops on sceKernelSyncOnAddressWait32 until the main thread wakes it, and the semaphore signaled while the handler waits (20 rounds). On main the outer wait never returns; with this PR it passes 3 of 3.

Title: God of War Sons of Sparta (PPSA28997) on Windows. Unity's GC stops threads with sceKernelRaiseException, and the handlers wait in sceKernelSyncOnAddressWait. Without this change the title froze after the intro logos in most runs (the collector thread waiting for a thread whose wakeup had been consumed). With this PR and a separate fix for threads blocked in scePthreadMutexLock (PR to follow), it got past the intro in 6 of 6 runs; with only one of the two it still froze in most runs.

I had written the same per-nesting-level waiter fix independently before finding this PR, so I'm not opening a duplicate.

Tested with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060119629 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476#issuecomment-6060119629). Originally posted by [merwie](https://github.com/merwie) on 2026-10-08T12:43:08Z. --- Tested on Windows 11 Pro 26200, WinLibs GCC 15.2.0 (r7), Release, at 39c3d045: - Builds without warnings in the changed files. - `guest_raise_exception`: passes 3 of 3 runs (8.4 s). With `TimedWait.cpp` from the merge base and the new test kept, it hits the 30 s ctest timeout 2 of 2 times, so the new phases fail without the change as expected. - `ctest -j8 -E "agc_driver|graphics"`: 254/254 passed. - An extra check that matches what I saw in a title: one thread blocked in `sceKernelWaitSema` with no timeout, a raise whose handler loops on `sceKernelSyncOnAddressWait32` until the main thread wakes it, and the semaphore signaled while the handler waits (20 rounds). On `main` the outer wait never returns; with this PR it passes 3 of 3. Title: God of War Sons of Sparta (PPSA28997) on Windows. Unity's GC stops threads with `sceKernelRaiseException`, and the handlers wait in `sceKernelSyncOnAddressWait`. Without this change the title froze after the intro logos in most runs (the collector thread waiting for a thread whose wakeup had been consumed). With this PR and a separate fix for threads blocked in `scePthreadMutexLock` (PR to follow), it got past the intro in 6 of 6 runs; with only one of the two it still froze in most runs. I had written the same per-nesting-level waiter fix independently before finding this PR, so I'm not opening a duplicate. Tested with AI assistance (Claude Code).
adriadam10 commented 2026-10-08 14:48:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T14:48:44Z.


Reviewed the diff: each nested TimedWait now gets its own waiter (own event, timer and queue links), busy is cleared in both waitSignal and waitSignalUntil, and the nested waiters are freed with the thread's first one. Linux is unchanged.

Windows evidence in the thread: @hikazey (Win11, Ryzen 9 5900X, 6/6 with the change, 6/6 timeouts with TimedWait.cpp from main, full suite 429/429), @merwie (Win11, 3/3, 2/2 timeouts without the change) and @popcoder565 (Win10, mutation check hangs in NestedWaitKeepsLaterWaiters). The Windows CI job is the remaining check; merging once it is green.

Heads-up: #1431 also edits GuestRaiseException.cpp and will need a rebase after this lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6062482711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1476#issuecomment-6062482711). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T14:48:44Z. --- Reviewed the diff: each nested `TimedWait` now gets its own waiter (own event, timer and queue links), `busy` is cleared in both `waitSignal` and `waitSignalUntil`, and the nested waiters are freed with the thread's first one. Linux is unchanged. Windows evidence in the thread: @hikazey (Win11, Ryzen 9 5900X, 6/6 with the change, 6/6 timeouts with `TimedWait.cpp` from `main`, full suite 429/429), @merwie (Win11, 3/3, 2/2 timeouts without the change) and @popcoder565 (Win10, mutation check hangs in `NestedWaitKeepsLaterWaiters`). The Windows CI job is the remaining check; merging once it is green. Heads-up: #1431 also edits `GuestRaiseException.cpp` and will need a rebase after this lands.
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!1476
No description provided.