XTaskQueue: terminating a queue cancels only its own queued callbacks #324

Open
github-bot wants to merge 1 commit from github-bot/gh-324 into main AGit
Owner

@⁠RenzoWit35 on GitHub · 2026-11-24 23:34 UTC · original
RenzoWit35:fix/243-terminate-cancels-only-its-own → main · +68 −4 · 1 files · 1 commits · open

Fixes #243.

A composite queue shares its ports with the queue they came from. XTaskQueueTerminate drained
every callback queued on those ports, so another queue's pending callbacks ran with
canceled=true and its next dispatch found nothing. Each queue now has a process-unique id
(not its address, which can be reused), delivered callbacks carry it, and terminate cancels
only its own, leaving the rest in FIFO order. Cancellations still run outside the port lock.
Delayed callbacks not yet delivered are #198's case, unchanged here.

Test terminating_a_composite_queue_leaves_the_base_queues_callbacks: base / composite / base
callbacks on one manual port; terminating the composite cancels only its own; the base then
dispatches its two in order, not canceled, and stays open. Fails on main.

Testing

On Windows 11, MSVC Rust 1.98.1, branch alone on top of main (2119b0e): cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo test --workspace --locked all pass. The new regression test fails on main and passes here. All nine fix branches for #242-#250 also pass together when merged.

🤖 Generated with Claude Code

**@⁠RenzoWit35** on GitHub · 2026-11-24 23:34 UTC · [original](https://github.com/fxceless/victory-fork/pull/324) `RenzoWit35:fix/243-terminate-cancels-only-its-own` → `main` · +68 −4 · 1 files · 1 commits · open Fixes #243. A composite queue shares its ports with the queue they came from. `XTaskQueueTerminate` drained every callback queued on those ports, so another queue's pending callbacks ran with `canceled=true` and its next dispatch found nothing. Each queue now has a process-unique id (not its address, which can be reused), delivered callbacks carry it, and terminate cancels only its own, leaving the rest in FIFO order. Cancellations still run outside the port lock. Delayed callbacks not yet delivered are #198's case, unchanged here. Test `terminating_a_composite_queue_leaves_the_base_queues_callbacks`: base / composite / base callbacks on one manual port; terminating the composite cancels only its own; the base then dispatches its two in order, not canceled, and stays open. Fails on `main`. ## Testing On Windows 11, MSVC Rust 1.98.1, branch alone on top of `main` (2119b0e): `cargo clippy --workspace --all-targets --locked -- -D warnings`, the same with `--all-features`, and `cargo test --workspace --locked` all pass. The new regression test fails on `main` and passes here. All nine fix branches for #242-#250 also pass together when merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A composite queue shares its ports with the queue they came from.
Terminating it drained every callback queued on those ports, so another
queue's pending callbacks ran as canceled and its next dispatch found
nothing. Each queue now has a process-unique id, delivered callbacks
carry the id of the queue they went through, and terminate cancels
only those, leaving the rest queued in their order (cancellations still
run outside the port lock). Delayed callbacks not yet delivered are
#198's case and unchanged here.

Test: base, composite, base callbacks on one manual port; terminating
the composite cancels its one, then the base dispatches its two in
order, not canceled, and stays open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:44 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 01:18 UTC · original

Duplicate of #296?

**@⁠kaayzouee** on GitHub · 2026-11-25 01:18 UTC · [original](https://github.com/fxceless/victory-fork/pull/324#issuecomment-7149415418) Duplicate of #296?
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/324/head:github-bot/gh-324'
git switch 'github-bot/gh-324'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-324'
git switch 'github-bot/gh-324'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-324'
git switch 'github-bot/gh-324'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-324'
git switch 'main'
git merge --squash 'github-bot/gh-324'
git switch 'main'
git merge --ff-only 'github-bot/gh-324'
git switch 'main'
git merge 'github-bot/gh-324'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.