gdk rt: Cleanup after the completion callback for a call completed in Begin, XAsyncSchedule on a completed call (2 conformance scenarios) #271
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!271
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/271/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?
@QuentinDanblon on GitHub · 2026-11-23 10:28 UTC · original
QuentinDanblon:pr/xasync-begin-cleanup→main· +147 −4 · 2 files · 1 commits · closed without mergingLibrary / area:
compat-common, GDK runtime XAsync (src/gdk/rt.rs), conformance scenarios (tests/support/xtq.rs)Exports changed (exports.txt rows): none
Source of the behaviour: measured on the PC
xgameruntime.dll10.0.26100.9656 (Gaming Services) throughgdk_xtaskqueue_conformance_real. No third-party code.This answers the question on #270 about a Begin op that fails. It is XAsync, not task queues, so it is not in #270. The two branches merge without conflict (
git merge-tree).What the PC runtime does after a failed Begin op
XAsyncBeginreturnsS_OK.XAsyncGetStatus(wait = false)andXAsyncGetResultSizereturn the Begin failure as soon asXAsyncBeginhas returned. No work is queued. The completion callback is queued on the completion port and reads the same status.Our runtime already did that. Two things next to it differed.
1. When Cleanup runs for a call completed during its Begin op
XAsyncCompleteinside Begin, same threadXAsyncCompletefrom another thread while Begin runsNow the three first rows match.
2.
XAsyncScheduleon a completed callS_OKbefore the completion callback had run,E_INVALIDARGafterE_INVALIDARG, nothing queuedS_OKby the same code path (read, not run)S_OK, DoWork runs againNow the rows match.
XAsyncSchedule(null)returnsE_INVALIDARGbefore the block is read.Scenarios
verify_failed_begin_reports_its_failure: the sequence described above, with the op counts the provider saw (Begin once, Cleanup once).verify_cleanup_waits_for_the_callback_when_begin_completes: 18 cases (five ways to complete, failure or success, with or without a callback). Each checks the number of Cleanup ops before the completion port is dispatched, the number the completion callback saw, the number after it, and whatXAsyncSchedulereturns and queues afterwards.Without the change to
rt.rs, onde1e1da: the first fails on theXAsyncSchedulecode (left: 0, right: 0x80091234), the second on the Cleanup count before dispatch (left: 1, right: 0).A Begin op returning
E_PENDINGis covered by yourverify_pending_begin_stays_pendingin r32j. I added nothing for it.Tests
On
4299f39(basede1e1da), RTX 5090 PC, Windows 11:cargo test -p compat-common --release --test gdk_xtaskqueue_conformance_real: 63 passed.--test gdk_xtaskqueue_conformance: 5 runs, 63 passed each.--lib: 4 runs, 147 passed each.pr_gate.py --base origin/main: 0 problems.XAsyncSchedulebefore or after the completion dispatch): the printed lines were identical.Not run green:
cargo test -p compat-common --releaseas a whole stops attests/gdk_fs_redirect.rs(new in r32j), which ends withSTATUS_STACK_OVERFLOWon this PC. Plainde1e1dadoes the same here, 2 runs of 2, so it does not come from this PR.Not covered, not claimed
This changes when a provider's Cleanup op runs on a path Trackmania uses at boot. I have no game dump, so no title was run.
The PC runtime is the reference here, not a console. I have no console measurement.
Between the return of the Begin op and the next instruction of
XAsyncBegin, a completion from another thread is still counted as "during Begin". Cleanup then runs after the callback instead of at once. I did not measure what the PC runtime does in that window.What
XAsyncScheduledoes on a call whose payload was already fetched is not measured.cargo test -p compat-commonpasses for what is listed aboveNo game or console files and no binaries included
No fake success; anything not possible is left
missingwith a note🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-23 13:31 UTC · original
Its commit is included in #210, which is being applied; this will be closed when that ships.
@omonkeyz on GitHub · 2026-11-25 13:09 UTC · original
Applied on main (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.
Pull request closed