feat(libc): implement _Thrd_detach #8636
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8636"
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 cadenasynyster on 2026-10-20T19:34:52Z.
What
Implements
_Thrd_detachin libc. Like_Thrd_join, it calls thepthread_detachthat libkernel registers on load (RegisterPthreadDetach_nid_no_patch, set fromRegisterPthreadOnLoad), so libc still does not link libkernel. It returns_Thrd_success(0) on success and_Thrd_error(4) whenpthread_detachfails, and throwsstd::runtime_errorif none is registered._Thrd_idis left as the existing throwing stub.The debt note for
[std::_Pad, _Thrd_join, _Thrd_detach, _Thrd_id]indocs/dev/debt/libc.mdis updated to cover_Thrd_detach.Tested
434e965d4.guest_libc_threadspasses with a newPadDetachcase: unregistered throws; registered, a launched pad detaches with success andnullptrreturns 4.ctest -R "thread|Thrd|ampr|pthread|libc_": 60/60 pass.python tools\check_conventions.py --base origin/mainpasses.eboot.bin), relinked with--windowsand run withAPS5_PLAYGO_UNLISTED_CHUNKS=installed: on main the only unresolved import isL7f7zYwBvZA(_Thrd_detach) from libc.prx (FAIL: unresolved ELF import). With this PR there are no unresolved imports and the title runs until_Thrd_id_nid_postfix not implemented._Thrd_idis deliberately not touched: its return type and width on the console are not known.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 repositoryImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T19:35:29Z.
Review: COMMENTED
The first trusted conventions run on head
a8b6d1creports three concrete issues: it cannot find the required### What,### Tested, and### Checklistsections (the body uses##headings), and the updatedstd::_Paddebt entry is 1136 characters, over the 1000-character limit. Please use the exact headings from.github/pull_request_template.mdand shorten the debt entry while retaining the newly documented detach behavior. The author-reported Windows tests are useful, but the current Linux/macOS hosted jobs are still running; I have not independently run this patch.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T19:35:42Z.
Progress report (
2185dbf→9e6544f)📈 System libraries: 64.47% (+0.01%, +1 implemented functions)
✅ 1 implemented
_Thrd_detach_nid_postfixImported from boykopovar/AnyPS5. Originally posted by Filip722 on 2026-10-20T19:49:32Z.
Independent Linux testing of head
9e6544fbab366d5c83a197d4279c7a693c8a620c:7.2.9-x64v3-xanmod1, AMD Ryzen 5 7640HS, GCC 15.2.0.BUILD_TESTING=ON,ANYPS5_RELINKER_ONLY=OFF, bundled dependencies. Built libc, libkernel and the seven focused test targets successfully.guest_libc_threads(including the newPadDetachcase),guest_ampr_threads,guest_pthread_join_detach,guest_pthread_second_join,guest_pthread_stack,guest_thread_self, andguest_thread_callback_abi.I also ran a standalone integration check against the freshly built, unpatched Linux libc/libkernel libraries, without replacing or manually registering the callbacks. It created a real guest thread with
scePthreadCreate, kept it alive while checking the results, then released it:This additionally exercises libkernel's load-time registration of
pthread_detach, which the newPadDetachtest replaces with its host helper.python3 tools/check_conventions.py --base origin/mainalso passed.Focused Linux runtime testing only; the full test suite and Animal Well were not run, and console ABI behavior was not verified.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T19:51:53Z.
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.
main)docs/dev/debt/libc.mdL130core/libs/tests/GuestLibcThreads.cppL34, L271, L278Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libc/src/Threads.cppcore/libs/prx/libc/src/Threads.cppdocs/dev/debt/libc.mdcore/libs/tests/GuestLibcThreads.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/prx/libc/src/Threads.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.md