feat(libc): implement _Thrd_lt #10788
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10788"
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 00xDisaster on 2026-10-25T00:49:15Z.
What
Add
_Thrd_lt, the C11 thread-helper comparison that orders twothrd_thandles by their integer addresses. This provides the strict total order assumed to backstd::thread::id. The declaration lives inApi.hpp; no other open PR implements this export._Thrd_yieldis intentionally left to open PR #8352, and this PR does not claim the_Thrd_*family is complete; the abort and creation helpers remain separate gaps. Firmware 13.42'slibSceLibcInternal.sprxexports_Thrd_lt(NIDOCbJ96N1utA) as a plain unsigned 64-bitfirst < secondon the two handles, returning 1 or 0, and BunnyFl verified it on all 121 tested handle pairs. C++ only requires a strict total order over thread IDs; arbitrary handle bit patterns still rely on the integer comparison.Tested
Linux CachyOS 7.3.0-2-cachyos, GCC 16.2.1. Base
upstream/main5b5d24cb22; head92db947130.oneandonlydean merged current
mainafter #10688 and #9269 landed. The merges kept both sides of the thread-test and debt conflicts; the_Thrd_ltimplementation and tests are unchanged.cmake --build build --target guest_libc_threads_tests --parallel 2: passed.ctest --test-dir build -R '^guest_libc_threads$' --output-on-failure: 1/1 passed in 0.06 s.guest_libc_threadschecks that a handle is not less than itself and that_Thrd_lt(a, b)and_Thrd_lt(b, a)are opposite for two distinct handles.libSceLibcInternal.sprx:_Thrd_ltcompares the two unsigned 64-bit handles and returns 1/0 on all 121 tested pairs.tools/check_conventions.py --base upstream/main --head HEADandgit diff --check: clean.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T00:52:28Z.
Review: CHANGES_REQUESTED
Reviewed exact head
ca84349a42. The implementation gives a strict total order over the opaque thread handles using their integer addresses, consistent with the local pointer-identity implementation. I compiled the changed source and test translation units with GCC 12.2, , and ran a harness linked to the exact implementation covering irreflexivity, pairwise asymmetry, expected address order and transitivity; all passed. and current-main conventions pass. The PR reports the focused CTest, while the full local target was unavailable because this environment lacks the full SDL2/XRandR build dependencies. One contribution-rule item needs correction before approval: the PR body says , but the commit message includes and GitHub lists Claude as a co-author. Please update the checklist to accurately disclose the assistance.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T02:34:40Z.
Review: APPROVED
Reviewed exact head
ca84349a4286b44fa7893e8e42a9edc6f56f32cc._Thrd_ltcompares the integer representations of the opaque handles, giving an irreflexive, asymmetric, transitive ordering for these values; this satisfies the unspecified total-order requirement used forstd::thread::id. LLVM libc++ uses the same<comparison for its platform thread IDs. The console-specific handle ordering remains unverified, and the PR records that limitation in the libc debt list. The focused test and hosted relinker checks pass; hosted product jobs are skipped by repository workflow. I found no open PR implementing_Thrd_lt.git diff --checkand the current-main conventions check pass locally.