fix(net): use native Windows condition waits for empty epoll #1588
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1588"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Roojool on 2026-10-08T13:50:48Z.
What
Related to #1471 (the empty-registration
sceNetEpollWaitpath only).With the supported WinLibs toolchain,
std::condition_variable::wait_untiluses winpthreads' coarseGetTickCount64deadline. A 1,000 us empty epoll wait can therefore take approximately one 15.6 ms tick despite the process requesting a 0.5 ms timer resolution.Use a translation-unit-local Windows SRW lock and native condition variable for the network registry. Preserve the existing steady-clock deadline, 100 ms polling slices, wake-all notifications, socket lifetimes and guest error behavior. Linux retains
std::mutexandstd::condition_variable. Unexpected native wait failures throw, matching the project's exact-or-throw policy.Extend
GuestSceNet.cppwith empty finite and zero waits, abort consumption, abort/destroy of indefinite waits, and adding a readable socket to a waiting epoll instance. The timing regression checks the median of nine 1 ms waits rather than imposing a bound on every sample.Tested
Windows 11 Home 10.0.26300, supported WinLibs GCC 15.2.0 UCRT POSIX SEH r7; WSL Ubuntu 26.04 LTS, GCC 15.2.0. Release builds,
BUILD_TESTING=ON, at most two compiler jobs, based on upstreamfd5342b6.guest_sce_net,guest_tcp,guest_udp,guest_poll,guest_addresses,guest_cond_timedwait,guest_nanosleep,guest_pthread_sem,guest_sync_on_address.guest_sce_netalso passed withAPS5_COARSE_TIMED_WAITS=1andAPS5_NO_TIMER_RESOLUTION=1: two additional passes. The latter intentionally omits the latency ceiling while retaining the timeout lower bound and all functional checks. Its 15.558 ms median reproduced an independent review finding, which the corrected test guard resolves.git diff --check: passed.libc,libkernel,libSceNetandlibSceNetCtl, then loaded the patched network library and invoked its epoll exports by NID on both platforms. Used the repository's patcher and the same--preserve-exportsinput as CMake; the generated packaging target's unrelated dependency fan-out was cancelled.Build and CTest commands (Windows
build; Linux/home/roojool/anyps5-net-epoll-linux):Full-project/GPU tests, console hardware and proprietary titles were not tested. The non-empty socket path still uses the existing bounded
WSAPoll/pollwaits. The existing registration-snapshot notification window remains bounded by the unchanged 100 ms slice. WSL reported that userfaultfd write watch was unavailable and used its existing memory-comparison fallback; no memory tracking behavior was changed.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:23:06Z.
Conflicts with main in
core/libs/tests/GuestSceNet.cppsince #1119 and #1838 landed; please rebase.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T00:17:46Z.
Rebased onto current
main(onlycore/libs/tests/GuestSceNet.cppconflicted after #1119/#1838; kept both test functions).Added one commit of our own:
sceNetGetMemoryPoolStats(new onmain) lockedg_mutexwithstd::lock_guard<std::mutex>, which would not compile on Windows now thatg_mutexis aHostMutex. It uses CTAD like the rest.Checked: build + the 11 tests in the touched directories pass on Linux. The 1 ms latency check only runs under
_WIN32, so the Linux run does not exercise it; the Windows numbers are yours.Merging once CI is green.
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-10T00:17:51Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.