feat(libc): implement libc++ shared mutex base #25289
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25289"
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 DonRyuzaki on 2026-11-21T21:24:10Z.
What
Implement the five
std::__1::__shared_mutex_baseconstructor, exclusive lock, and shared lock exports inlibcrequested by the Azahar RetroArch import inventory. The guest object uses the libc++ 17.0.6 mutex, two-condition-variable, and state layout, with the same writer-preferring algorithm. It reuses AnyPS5's existing guest pthread mutex and condition-variable bridges. A focused concurrency test covers simultaneous readers, a writer waiting for readers, a reader waiting behind that writer, wakeups, and invalid guest addresses.The Azahar diagnostic module and a PS5 console have not been run with this branch. The console provider, ABI, and behavior remain unverified and are recorded in the libc technical-debt fragment. The implementation is generic and does not depend on the title or a specific import value.
Tested
Head
2177241c3d38cf40fd7a7a401ffd729e2640feebon baseef7dc4452df4f822a741f6338e994acc704f0bc7(21 November 2026). Windows 11, WinLibs GCC 15.2, CMake Release:guest_libcxx_shared_mutex_testsbuilt on this head;ctest -R ^guest_libcxx_shared_mutex$ --repeat until-fail:3passed 3/3, andpublic_headerspassed 1/1. The PE export table contains all five exact symbols. Ubuntu WSL2, GCC 13.3, CMake Release: the same focused target built and the focused CTest passed 3/3 on the preceding base. The rebase onto this base is clean and changes none of this PR's five files. The final base advance since the last Windows and Linux test runs touched none of this PR's files.tools/check_conventions.py --base upstream/mainandgit diff --checkpassed. The new libc debt fragment passedtools/debt_fold.py --checkin an isolated tree; the current upstream-wide debt check fails on two unrelated pre-existinglibkernel_sysfragments (sceKernelIsNeoModeandsceKernelTitleWorkaroundIsEnabled). The five exact symbol names had no matching implementation on current upstream main or in the 2,316 open PRs scanned bytools/pr_overlap.py --nameson 21 November 2026. The final branch scan fetched 2,298 open PR heads; 64 shared-file PRs merge-tested with no confirmed same-function overlap. Twenty-two base-conflicted PRs were manually checked in their shared libc CMake/API diffs; none adds these exports or changes their source. The Azahar module and a physical PS5 were not run with this branch.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T22:07:18Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
2177241c3d:tools/check_conventions.pypassed.guest_libcxx_shared_mutex_testsbuilt cleanly.guest_libcxx_shared_mutex):core/libs/prx/libc/include/Api.hpp,core/libs/prx/libc/src/LibcxxSharedMutex.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T17:48:29Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and focused test support merging, while console ABI and runtime behavior remain unverified.
What I ran
Reviewed head
2177241c3d38cf40fd7a7a401ffd729e2640feebusing the prepared diff andrepo_read.py. No build or tests were run during this review; test results below are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The prepared
files.jsonwas unavailable through the reader, so I could not confirm thereviewedversusexcludedlists. The full text of all five changed files listed in the manifest was read; no additional excluded-file list was available. I did not run the build, tests, Azahar diagnostic module, or a physical PS5, so console ABI and runtime behavior are unconfirmed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T21:50:11Z.
Review: COMMENTED
Actionable comments
core/libs/prx/libc/CMakeLists.txt, lines849· 📐 Maintainability & Code Quality · ⚡ Quick wincore/libs/prx/libc/tests/cmake/guest_libcxx_shared_mutex_tests.cmake. Keep the production source registration here. This keeps the new test self-contained and follows the repository&`#39`;s registration contract.tests/cmake/<executable>.cmakefragment.0c0bff77-a4cc-4782-9b2b-23ca4752398fReviewing files that changed from the base of the PR and between
b396d834cbandb04b9b8b84.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/include/Api.hppcore/libs/prx/libc/src/LibcxxSharedMutex.cppcore/libs/tests/GuestLibcxxSharedMutex.cppdocs/dev/debt/changes/codex-libcxx-shared-mutex-20261121.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T22:03:41Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: initialize the embedded guest mutex and condition variables in the constructor before the lock operations use them.
What I ran
Reviewed head
b04b9b8b843746fc026472e90d72e947b5358930. Read the prepared description, commits, manifest, file list, and diff. Read all five changed files and targeted pinned-head context inLibcxxPlainMutex.cpp,LibcxxCondition.cpp,Api.hpp, andSceTypes.hppusingrepo_read.py.Results
Findings
Blocking
core/libs/prx/libc/src/LibcxxSharedMutex.cpp:69-72: The constructor sets the guest mutex and condition-variable handles to null, and no subsequent code initializes them. The lock methods immediately pass the null mutex handle to the existing mutex bridge (:77); that bridge validates the handle and forwards it to pthread locking. Contended paths also pass null condition-variable handles to the condition bridge. The added test manually callspthread_mutex_init_nid_postfixafter construction, so it does not exercise the constructor's missing mutex initialization; it does not initialize either condition variable. Initialize the guest synchronization objects as the corresponding libc++ constructors do, and ensure the test exercises the actual constructor path.Non-blocking
None.
Not verified
files.jsonlists five reviewed files and no exclusions. The focused tests reported in the description were not rerun.To get this to a good state
Initialize the mutex and both condition variables in the shared-mutex constructor, update the test to cover constructor-created resources, and rerun the focused shared-mutex test.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T10:50:48Z.
Review: COMMENTED
The GuestLibcxxSharedMutex fixture coverage passed on Linux with the exact implementation from this head. The fixture covers lazy condition setup, a reader waiting behind a writer and invalid guest storage.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.