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

Merged
gefydev merged 1 commit from upstream-pr/57 into main 2026-11-23 09:44:41 +00:00
gefydev commented 2026-11-22 23:03:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-22T23:03:10Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6548966739 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/57). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-22T23:03:10Z. --- `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.
upstream-sync closed this pull request 2026-11-24 06:56:57 +00:00
ivall commented 2026-11-24 07:00:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T09:45:16Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7097053118 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/57#issuecomment-7097053118). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T09:45:16Z. --- 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!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!56
No description provided.