feat(ult): implement blocking queues and shared data pools #613
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/613"
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 nicolasabosch on 2026-10-05T03:52:33Z.
What
sceUltQueuePushpreviously returned success when a queue was full and discarded the new item. It now waits for a free slot, andsceUltQueuePopwaits for data. AddsceUltQueueTryPush,sceUltQueueDestroy, andsceUltQueueDataResourcePoolDestroy; retain nonblocking empty-queue errors throughsceUltQueueTryPop.Queues share a preallocated pool of payload slots instead of each receiving the pool's entire capacity. Enforce the queue-object limit, validate sizes and duplicate creation, check work-area size arithmetic for overflow, reclaim slots on destruction, and wake blocked callers during finalization. Separate notifications for queue data and pool capacity avoid waking unrelated consumers.
Non-null queue and data-pool option parameters throw rather than being silently ignored. TechnicalDebt records the remaining limits: storage is host-backed, guest work-area/object layouts and inferred PS5 signatures/error/teardown behavior are unverified, and waiting-pool thread limits and waiter priority ordering are not implemented.
Tested
Windows, MinGW-w64 GCC 15.2.0:
libstarget, including PRX NID patching, passed.origin/mainconfirmed the full-queue push returned success immediately; with this implementation it blocks and finalization wakes it withULT_ERROR_STATE.git diff --checkpassed. No game title, PS5 hardware, or Linux runtime was tested.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); remaining queue limitations are recorded in TechnicalDebtImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T03:52:56Z.
Progress report (
4dac9d6→043332b)📉 System libraries: 79.01% (-0.03%, +4 implemented, -2 reverted functions)
✅ 4 implemented
sceUltQueueDataResourcePoolDestroysceUltQueueDestroysceUltQueuePopsceUltQueueTryPush⚠️ 2 went back to stubs
sceUltQueueCreatesceUltQueueDataResourcePoolCreateImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T05:03:56Z.
Thanks, this fixes a real problem: a full queue used to drop the item and still report success. I read it through with the threading in mind:
scePthreadCreate), so blocking on a condition variable is right.gMutexfirst, then the pool mutex._waitersis only changed under the pool mutex, and a queue destroyed or finalized while a caller is betweenqueueGetStateand the lock is caught by the_alivecheck.sceUltFinalize._spaceAvailable, which is right because any free slot will do, and destroying a queue wakes them all.dataSizeinside the pool's stride.sceUltQueuePop,sceUltQueueTryPush,sceUltQueueDestroyandsceUltQueueDataResourcePoolDestroyare real libSceUlt exports (all four names are in the usual NID lists). Their argument lists and error rules are inferred, and the TechnicalDebt lines say so.The six
guest_ult_queue_*tests pass here on Linux (GCC, Release). I also ran them 25 times in a row with--repeat until-failand-j6, with no failures. The full ctest passes with this merged. On main,guest_ult_queue_testsdoesn't link, since the three new functions are missing. I also checked the second commit: it only moves the TechnicalDebt line to the end of its section, and the code is unchanged.PPSA21564 doesn't import libSceUlt, so this doesn't need my PPSA21564 check. Ready to merge from my side.