XAsync: cancellation is the provider's to do #53
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!53
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/53/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?
@gefydev on GitHub · 2026-11-22 22:41 UTC · original
gefydev:xasync-cancel-to-provider→main· +69 −1 · 1 files · 1 commits · merged 2026-11-23 09:44 UTCXAsyncCancel(xasync.rs) calls the provider withXAsyncOp::Canceland then completes the block withE_ABORTitself. libHttpClient'sXAsyncCancel(Source/Task/AsyncLib.cpp) only calls the provider. A provider that supports cancelling completes withE_ABORT, now or later. One that doesn't, like the provider behindXAsyncRun, which ignoresCancel, runs to its normal end.Forcing the completion has two effects in XCL's fallback (no Gaming Services):
XAsyncRunor a provider that ignoresCancelends withE_ABORT, and work that hasn't started yet never runs.E_ABORThas no payload, soXAsyncCompleteruns the provider'sCleanupright away, even if itsDoWorkis still running on the queue. For XCL's own operations (begin_with), thatCleanupfrees thePayload. The running work then writes its result into it when it returns (*p.result.lock() = Some(r)inpayload_provider).XAsyncCancelnow only calls the provider. XCL'spayload_provideralready ignoresCancel, so XCL's own operations finish normally, asXAsyncRundoes in libHttpClient.Validation
cancel_is_the_providers_to_do: a provider that ignoresCancelstays pending and completes normally; one that completes inCancelends withE_ABORT. The first half fails onmain.cancel_lets_running_work_finish: cancels abegin_withoperation while its work is running, then reads the work's result. Onmain, the status isE_ABORTright after the cancel.cargo test -p xcl --lib: 341 passed, 0 failed, on Windows GNU under Wine.@ivall on GitHub · 2026-11-23 09:45 UTC · original
Merged in
848e740(mergea963568). Matches libHttpClient'sXAsyncCancel; the payload freed under a running DoWork was a real hazard in the fallback path.Tested on Windows 11 (RX 9070):
cargo test --workspacegreen (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!