Task queues: a terminated queue takes no new work #57

Manually merged
github merged 1 commit from gh-pr/57/head into gh-pr/57/base 2026-11-26 04:06:58 +00:00
Owner

@⁠gefydev on GitHub · 2026-11-22 23:03 UTC · original
gefydev:taskqueue-submit-after-terminate → main · +33 −1 · 1 files · 1 commits · merged 2026-11-23 09:44 UTC

XTaskQueueSubmitCallback, XTaskQueueSubmitDelayedCallback and XTaskQueueRegisterWaiter accept work on a queue after XTaskQueueTerminate. That work then runs canceled, and a delayed callback runs after the termination callback has already told the title that the queue is done: a title that frees its context there gets a callback on freed memory. This happens, for example, with a callback that reschedules itself from its own canceled invocation during termination.

libHttpClient rejects new work on a terminating or terminated port with E_ABORT (TaskQueuePortImpl::VerifyNotTerminated, called from QueueItem and RegisterWaitHandle). The three functions now do the same.

E_ABORT_QUEUE_TERMINATED is removed: it was unused, and its value (0x80040001) is not E_ABORT (0x80004004).

Complements #54 (delayed callbacks already pending when the queue terminates); no conflicts between the two.

Validation

  • New test a_terminated_queue_takes_no_new_work. On main the first submit after Terminate returns S_OK instead of E_ABORT.
  • cargo test -p xcl --lib: 344 passed, 0 failed, on Windows GNU under Wine.
**@⁠gefydev** on GitHub · 2026-11-22 23:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/57) `gefydev:taskqueue-submit-after-terminate` → `main` · +33 −1 · 1 files · 1 commits · merged 2026-11-23 09:44 UTC `XTaskQueueSubmitCallback`, `XTaskQueueSubmitDelayedCallback` and `XTaskQueueRegisterWaiter` accept work on a queue after `XTaskQueueTerminate`. That work then runs canceled, and a delayed callback runs after the termination callback has already told the title that the queue is done: a title that frees its context there gets a callback on freed memory. This happens, for example, with a callback that reschedules itself from its own canceled invocation during termination. libHttpClient rejects new work on a terminating or terminated port with `E_ABORT` (`TaskQueuePortImpl::VerifyNotTerminated`, called from `QueueItem` and `RegisterWaitHandle`). The three functions now do the same. `E_ABORT_QUEUE_TERMINATED` is removed: it was unused, and its value (`0x80040001`) is not `E_ABORT` (`0x80004004`). Complements #54 (delayed callbacks already pending when the queue terminates); no conflicts between the two. ## Validation - New test `a_terminated_queue_takes_no_new_work`. On `main` the first submit after `Terminate` returns `S_OK` instead of `E_ABORT`. - `cargo test -p xcl --lib`: 344 passed, 0 failed, on Windows GNU under Wine.
XTaskQueueSubmitCallback, XTaskQueueSubmitDelayedCallback and
XTaskQueueRegisterWaiter accepted work on a terminated queue. Such work
ran canceled, and a delayed callback ran after the termination callback
had already told the title the queue was done. They now return E_ABORT,
as libHttpClient's VerifyNotTerminated does.

E_ABORT_QUEUE_TERMINATED (unused, and not E_ABORT's value) is removed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:06:58 +00:00
github manually merged commit 5c6bbc520e into gh-pr/57/base 2026-11-26 04:06:58 +00:00
Author
Owner

@⁠ivall on GitHub · 2026-11-23 09:45 UTC · original

Merged (eb8ed07). Extended to XAsyncSchedule in e38cb65 (it submitted through the internal submit_delayed, past the new check).

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!

**@⁠ivall** on GitHub · 2026-11-23 09:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/57#issuecomment-7097053118) Merged (eb8ed07). Extended to `XAsyncSchedule` in e38cb65 (it submitted through the internal `submit_delayed`, past the new check). 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.