feat(xgameruntime): implement the remaining XTaskQueue functions #39
No reviewers
Labels
No labels
accessibility
bug
ci
docs
documentation
duplicate
enhancement
fixes issue
good first issue
help wanted
invalid
library request
libs
needs rebase
question
relinker
stale
tools
unblocks title
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Dark3581--AnyBox!39
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/39/head"
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?
@CaseReed on GitHub · 2026-11-22 18:48 UTC · original
CaseReed:feat/xtaskqueue-rest→main· +1154 −144 · 10 files · 1 commits · merged 2026-11-22 20:50 UTCWhat
Implements the six functions of #23, the whole issue:
XTaskQueueCreateComposite,XTaskQueueGetPort,XTaskQueueRegisterMonitor,XTaskQueueUnregisterMonitor,XTaskQueueRegisterWaiter,XTaskQueueUnregisterWaiter. Behaviour follows the public MIT libHttpClient task queue (Source/Task/TaskQueue.cpp) and its unit tests (TaskQueueTests.cpp); signatures come from the publicXTaskQueue.hand the GDK documentation. Nothing is measured on a console; every difference from the reference is in the debt fragment.Design, in
TaskQueue.cpp:XTaskQueueGetPortreturns the port; a composite holds two ports and keeps their source queues alive. Terminating a queue removes only its own callbacks, delayed callbacks and waiters from a shared port, andXTaskQueueTerminate(wait)waits only for that queue's work.XTaskQueueUnregisterMonitorwaits for calls of that monitor running on other threads.canceled = true; closing a queue unregisters its waiters without calling them.XTaskQueueCreateCompositereturnsE_GAMERUNTIME_INVALID_HANDLE(0x8924010C, from the public GDK error code list), checked against a registry of live ports without reading the handle.Two changes to existing behaviour, both towards the reference:
XTaskQueueTerminate(queue, true, ...)from a callback submitted through that queue now stops withAbxUnsupportedon every port kind. The debt already said so, but the check only covered thread-pool callbacks: from a manual-dispatched or immediate callback it deadlocked.Stops (
AbxUnsupported), each listed in the fragment: unregistering a monitor from inside its own callback (the reference waits forever), closing the queue handle given to a monitor, and a waiter handle signaled as an abandoned mutex (the reference ignores it and leaves a dead registration).Tested
Windows 11, MSVC 19.38 (VS 2022), Ninja, Release, clean build directory, with #38 applied locally only to get MSVC to build (not part of this PR):
pipeline_probeskipped: no Khronos validation layer on this machine). Five new e2e scenarios:taskqueue_composite,taskqueue_monitor,taskqueue_monitor_reentry,taskqueue_waiter,taskqueue_terminate_reentry.taskqueue*andasync*scenarios repeated 50 times: 500/500.python tools/check_conventions.py,python tools/debt_fold.py --checkpass;tools/progress.py --module xgameruntime: 58 to 64 implemented.TaskQueue.cpp,FakeTitle.cppandFakeXGameRuntime.cppcompile with-Wall -Wextraand no warning on MinGW-w64 GCC 13.1, 15.2 and 16.2 (Compiler Explorer).Not tested: no MinGW binary was run here, the Windows CI job is the check for it. The abandoned-mutex stop and the path where a signal cannot be queued on a live queue (the thread pool refusing work) have no test. Nothing was measured on a console.
Self-review: an independent pass over the diff found one data race (a composite published to a shared port from its constructor, before it could be referenced safely) and the terminate-from-callback deadlock above; both are fixed in this commit, the first with a stress block in
taskqueue_composite(2000 composites created and closed over a port that receives work). That block guards against the race coming back; it does not prove the fix, since the race almost never shows on x64. Timing checks in the new scenarios were rewritten as event hand-offs where a slow runner could have caused a false failure.Checklist
main; no other open PR implements the same functionspython tools/check_conventions.pypasses (no comments in code, one declaration per export, Conventional Commit subjects)AbxNotImplemented/AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragmentdocs/dev/debt/changes/<branch>.mdTaskQueue.cpp,TaskQueueTests.cpp,XTaskQueue.h(MIT); GDK XTaskQueue documentation and error code list🤖 Generated with Claude Code
@github-actions[bot] on GitHub · 2026-11-22 18:48 UTC · original
Progress report (
9486199→8539a07)📈 Libraries: 26.34% (+1.3393%, +6 implemented functions)
✅ 6 implemented
XTaskQueueCreateCompositeXTaskQueueGetPortXTaskQueueRegisterMonitorXTaskQueueRegisterWaiterXTaskQueueUnregisterMonitorXTaskQueueUnregisterWaiterChanged libraries
@Dark3581 on GitHub · 2026-11-22 20:50 UTC · original · approved these changes
Reviewed — looks good
The port and composite model follows the reference closely and the tests cover the hard parts; merging.
What I ran
Head
8539a07, merged onto currentmain. Windows 10, MinGW (WinLibs GCC 15.2 UCRT), Ninja, Release, clean build directory.Results
taskqueue_*scenarios includede2e_taskqueue*ande2e_async*repeatedcheck_conventions.pydebt_fold.py --checkprogress.py --module xgameruntimeFindings
Blocking
None.
Non-blocking
DisarmskippingWaitForThreadpoolWaitCallbacksfrom inside the wait callback,RunWaiterre-arming only whilearmed, andWaitSignaledholding the waiter throughshared_from_this. They hold up; the abandoned-mutex stop is the right call while nothing measures what a console does.core/libs/tests/CMakeLists.txtanddocs/dev/ARCHITECTURE.md; whichever lands second needs the small rebase you mentioned.Not verified
MSVC (this machine's Windows SDK 22621 has no
gameinput.lib, so I ran MSVC only for #38), and anything on a console.Thanks — the mutation runs and the stress block for the composite race are exactly what a change to shared queue state needs.