Skip to content

XAsync: a failing Begin fails the call, and E_PENDING does not complete - #56

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:xasync-begin-complete-contract
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:xasync-begin-complete-contract

Conversation

@gefydev

@gefydev gefydev commented Nov 22, 2026

Copy link
Copy Markdown
Member

Two differences from libHttpClient's AsyncLib.cpp in how xasync.rs reports results:

  • XAsyncBegin: when the provider's Begin fails, the call is completed with that error, and XCL also returned it from XAsyncBegin. libHttpClient returns S_OK there: the caller gets the error once, through the block. A title that treats a failed XAsyncBegin as "nothing was started" and frees the block, or retries, does so on a block that was already completed (and whose completion callback may already be queued). XAsyncRun likewise when its schedule fails.
  • XAsyncComplete(b, E_PENDING, ...): libHttpClient returns without completing ("E_PENDING is special -- if you still have work to do don't complete"). XCL turned it into E_FAIL and completed the call, ending an operation the provider meant to keep running.

Both now follow libHttpClient.

This is independent of #53 (which changes XAsyncCancel in the same file); the two merge without conflicts.

Validation

  • New tests a_failing_begin_fails_the_call_not_xasyncbegin and completing_with_e_pending_does_not_complete. On main both fail (XAsyncBegin returns E_FAIL; the status after XAsyncComplete(E_PENDING) is E_FAIL instead of E_PENDING).
  • cargo test -p xcl --lib: 345 passed, 0 failed, on Windows GNU under Wine.

As in libHttpClient's AsyncLib.cpp:

- XAsyncBegin returns S_OK when the provider's Begin fails: the call is
  completed with that error, and the caller gets it once, through the
  block. XCL returned the error as well, so a caller saw it both as the
  return value and in its completion. XAsyncRun likewise when its
  schedule fails.
- XAsyncComplete with E_PENDING does nothing (the provider still has
  work to do). XCL completed the call with E_FAIL.
@ivall
ivall merged commit daa27b0 into xcl-dev:main Nov 23, 2026
ivall added a commit that referenced this pull request Nov 23, 2026
Like XTaskQueueSubmitDelayedCallback since #57 (libHttpClient schedules through it): E_ABORT,
so XAsyncRun / XCL's own operations on a terminated queue fail through the block (#56) and
their work never runs. Test async_work_on_a_terminated_queue_is_aborted; the task queue
module comment follows #54 / #57.
@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Merged (daa27b0). Follow-up in e38cb65: XAsyncSchedule on a terminated queue returns E_ABORT like XTaskQueueSubmitDelayedCallback after #57, so with this PR such an XAsyncRun / XCL operation fails through the block and its work never runs (test async_work_on_a_terminated_queue_is_aborted).

Tested on Windows 11 (RX 9070): cargo test --workspace green (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants