Repository navigation
feat(libkernel): select on pipes on Windows - #5013
Conversation
|
Follow-up Linux validation of this change on current Ubuntu 26.04.1 / WSL2, GCC 15.2.0, Ninja Release, bundled dependencies, This was a scoped library build and native Linux test run, not a full Linux application build or a Linux RetroArch run. No further game run was performed. AI-assisted validation with Codex; Claude's original implementation remains unchanged. |
CnRJay
left a comment
There was a problem hiding this comment.
Reusing PipeReadiness from poll keeps the two consistent. One timing detail: the new Windows HostPoll loop waits with std::this_thread::sleep_for(std::chrono::milliseconds(1)). On Windows that sleep follows the coarse system tick and usually takes about 15.6 ms, as measured in #1471, which is why #4980 (poll) and #4754 (select timeouts) move these waits to PreciseSleepUs.
For libmicrohttpd's wake-up pipe, that means each wake-up of the MHD-worker thread can be delayed by up to ~15 ms. A select with a short timeout also overshoots it by the same amount. PreciseSleepUs(1000) (high-resolution waitable timer, no spinning) gives the 1 ms slice the description intends at the same CPU cost.
select now checks pipe descriptors on Windows with the readiness test poll already uses, so a pipe next to a libSceNet socket no longer throws. RetroArch (PPSA99169) selects on libmicrohttpd's wake-up pipe beside its listening socket. guest_select now runs on Windows too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76a168f to
f288daf
Compare
|
Rebased onto |
What
On Windows,
selectthrew for any descriptor that is neither a guest socket nor a libSceNet socket. RetroArch (PPSA99169) in RetroArch mode stops there:gdb shows the throw on the
MHD-workerthread, GNU libmicrohttpd's server worker behind RetroArch's web UI. The descriptor is the read end of a pipe from the guest'spipe()(gdb onpipe_nid_postfixreturned 4 and 5): libmicrohttpd's inter-thread wake-up channel, selected next to its listening socket. #3644 already taughtpollto handle such a pipe;selecthad no Windows counterpart for its host group.select's host group now has a Windows poller too. It uses the samePipeReadinesstest aspoll(Udp.cpp, exposed asGuestSockets::PipeReady): readable with data or when the write end is closed, writable with at leastPIPE_BUF(512) bytes of quota. It checks the pipes every millisecond until the slice ends, and reportsEBADFfor a closed descriptor as Linux'sHostPolldoes. A descriptor that is neither a socket nor a pipe still throws, now saying so. Linux is unchanged. Theselectentries indocs/dev/debt/libkernel.mdare updated.Tested
guest_select, which was registered only off Windows, now runs on Windows and passes. It covers an idle pipe timing out, a readable read end, a writable write end, both at once, a pipe next to a guest socket with both ready, andEBADFafter closing. Without the change it fails on Windows (it throws on the first pipe). All 124 libkernel tests pass on Windows 11 (MinGW GCC 15.2.0); the Linux path is unchanged and was not rebuilt locally.retroarch.logshows the Vulkan swapchain,[Autoconf] PS5 Controller configured in port 1, and the playlists loaded, with about 11 submissions per second.python tools/check_conventions.py --base origin/main,tools/check_test_registration.pyandtools/pr_overlap.pypass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code