startup: implement XAsyncGetStatus and XAsyncGetResultSize in xgameruntime #2200
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2200
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2200/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?
@tedin7 on GitHub · 2026-11-25 04:19 UTC · original
tedin7:x2w-w4-xasync-status→main· +397 −15 · 6 files · 2 commits · merged 2026-11-25 05:14 UTCPart of #870
What this unblocks: startup code can poll
XAsyncGetStatus(wait=false)and readXAsyncGetResultSizeon the manual-queue async blocks from #2179, using the completion-port contract from #2170.Change
XAsyncGetStatusandXAsyncGetResultSizeare now implemented insrc/xgameruntime_shim.cppfor blocks the shim tracks (XGameSaveInitializeProviderAsync).wait=false:E_PENDINGwhile the completion callback still waits forXTaskQueueDispatchon the manual queue, thenS_OK(or the stored error).wait=truenever blocks: a started operation has completed before its Begin call returns.XAsyncGetResultSize:E_PENDINGbefore dispatch, then the exact size (one provider handle) without consuming the result. The output is cleared on every refusal.E_INVALIDARGfor a null, untracked or already consumed block;E_POINTERfor a null size output.xgameruntime_async_status(before/after dispatch, no-callback block, status inside the callback, null/untracked/consumed refusals, queue-close guard, block bytes untouched).xgameruntime_thunksno longer listsXAsyncGetStatusas a stub;xgameruntime_table_check.pyrequires both rows as implemented.docs/experiments.mdupdated.Note:
startup_async_manual_completiondocuments that the installed runtime reportsS_OKfor a completed-but-undispatched block. This change deliberately keeps the shim consistent with its existingXGameSaveInitializeProviderResult(E_PENDINGuntil dispatch); follow-up if the two should both follow the runtime.Verification
Linux:
python3 -B tests/xgameruntime_table_check.py-> PASS (exports=32, stub=2)python3 -B tests/docs_links_check.py-> PASSpython3 -B tests/run_checks_parallel_check.py-> okx86_64-w64-mingw32-g++ -std=c++17 -fsyntax-onlyon the shim and the new test -> cleanWin2025 (Build 26100, MSVC 14.44 + D3D12 WARP, 3-slot pool) at
3609d3c1,x2w_pipe.py win2025 2200 --force --regex "^xgameruntime_":ctest --preset dev -R '^xgameruntime_' --no-tests=error-> 8/8 passed, none skipped (incl.xgameruntime_async_status)ctest --preset release -R '^xgameruntime_' --no-tests=error-> 8/8 passed, none skippedAI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 04:29 UTC · original · edited 2026-11-25 04:33 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
3609d3cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@tedin7 on GitHub · 2026-11-25 05:00 UTC · original
Addressed in
7431bdd8.Fix:
XAsyncGetStatusandXAsyncGetResultSizenow keep operation completion and callback dispatch separate. Once the provider work has finished, both report the stored status and a result size of one provider handle, even while the callback still waits forXTaskQueueDispatch. Only a block whose work is still in flight isE_PENDING.wait=trueon such a block sleeps on the runtime condition variable until the work completes (or the start fails, thenE_INVALIDARG);wait=falsereturnsE_PENDING.Regression test:
xgameruntime_async_statusnow does Begin, polls status (wait=false and wait=true) and size before the first dispatch (expectsS_OKand the handle size, zero callbacks), then dispatches exactly once (callback count 1). The refused-queue-close case checks the same. Docs updated indocs/experiments.md.Not covered: a deterministic test of a block that is still in flight with a concurrent
wait=truequery. The provider start finishes too fast to hold open from a source-built fixture, so that path is by inspection only.#2201: the result size here comes from this slot table (one provider handle), not from a shared constant. User-add slots should report their own size.
Verification:
python3 -B tests/xgameruntime_table_check.py,tests/docs_links_check.py,tests/run_checks_parallel_check.pyall PASS.python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 2200 --force --regex "^xgameruntime_"gave dev 8/8 and release 8/8, zero skips,[PASS] PR #2200@7431bdd8.AI-assisted; commands listed were executed locally.
@R0Y00 on GitHub · 2026-11-25 04:47 UTC · original · requested changes
The new queries can turn a native completion poll into a wait that never advances. On the installed Windows runtime,
startup_async_manual_completion_systemmeasuredXAsyncGetStatus(block, false) == S_OKand a nonzero result size after completion while the callback count was still zero. This implementation returnsE_PENDINGfor both queries until the caller dispatches the callback. A caller that polls status before deciding to dispatch would keep polling even though the provider already completed.Please keep operation completion and callback dispatch separate for both new queries. Add a source-built control that does Begin → poll status and size before the first completion dispatch → dispatch exactly once. Also cover a truly pending reserved block and the difference between
wait=falseandwait=trueif a concurrent query can observe it. The per-operation Result behavior already merged in #2179 can be reviewed separately from these two new exports. Please coordinate the shared changes with #2201 so its user-add slots don't inherit a provider-only result-size assumption. GDK status contract@R0Y00 on GitHub · 2026-11-25 05:14 UTC · original · approved these changes
Re-reviewed
7431bdd8. The two queries now expose a completed provider operation before completion-port dispatch. The operation-specific Result still claims the provider once under the existing queue contract. Independently ran Windows Release xgameruntime async status, save async, thunks and table tests: 4 passed, zero skips. A genuinely in-flight concurrent wait is covered by inspection of the locked predicate and both wake paths here; the native tests exercise the completed-before-dispatch branch.