XAsync: cancellation is the provider's to do #52
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/53"
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 ivall/xcl. Originally posted by gefydev on 2026-11-22T22:41:17Z.
XAsyncCancel(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.Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T09:45:13Z.
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!