Keep other queues' tasks queued when terminating a composite queue #436

Closed
github-bot wants to merge 660 commits from github-bot/gh-436 into main AGit
Owner

@⁠ahmetbagci8 on GitHub · 2026-11-29 10:51 UTC · original
ahmetbagci8:fix/xasync-composite-terminate → main · +60071 −5436 · 206 files · 660 commits · closed without merging

Summary

Composite queues created with XTaskQueueGetPort + XTaskQueueCreateComposite share the same Arc<Port> and port.tasks queue. Previously, XTaskQueueTerminate called lock(&port.tasks).drain(..), which drained and canceled (task.run(true)) queued tasks submitted to other open queues sharing that port.

Changes

  • Give each Queue a unique id: u64 and tag queued tasks in Port::tasks with their owning queue id.
  • In XTaskQueueTerminate, remove and cancel only tasks owned by the terminating queue, preserving other queues' tasks in FIFO order.
  • Add unit test terminating_a_composite_queue_leaves_other_queues_tasks_queued.

Tested

  • cargo test -p victory-hle --lib xasync: 17 passed; 0 failed; 0 ignored
  • cargo clippy -p victory-hle --tests: clean (0 warnings)
**@⁠ahmetbagci8** on GitHub · 2026-11-29 10:51 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/436) `ahmetbagci8:fix/xasync-composite-terminate` → `main` · +60071 −5436 · 206 files · 660 commits · closed without merging ### Summary Composite queues created with `XTaskQueueGetPort` + `XTaskQueueCreateComposite` share the same `Arc<Port>` and `port.tasks` queue. Previously, `XTaskQueueTerminate` called `lock(&port.tasks).drain(..)`, which drained and canceled (`task.run(true)`) queued tasks submitted to *other* open queues sharing that port. ### Changes - Give each `Queue` a unique `id: u64` and tag queued tasks in `Port::tasks` with their owning queue `id`. - In `XTaskQueueTerminate`, remove and cancel only tasks owned by the terminating queue, preserving other queues' tasks in FIFO order. - Add unit test `terminating_a_composite_queue_leaves_other_queues_tasks_queued`. ### Tested - `cargo test -p victory-hle --lib xasync`: `17 passed; 0 failed; 0 ignored` - `cargo clippy -p victory-hle --tests`: clean (0 warnings)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 10:55:38 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-11-29 11:20 UTC · original · reviewed

Ran this on Windows. cargo test -p victory-hle --lib xasync gives 17 passed, the new composite test included, and cargo clippy -p victory-hle --all-targets -D warnings is clean.

The terminate path keeps other owners' tasks in FIFO order, it's all done under the one port.tasks lock, and the wake for waiting dispatches still comes after it, so the comment about nobody missing both the flag and the wake still holds. The ids come from a global counter, so a closed queue's id can't come back on a new one sharing the port.

Heads-up: it conflicts with your #348, but only at the end of mod tests, where both append a test. Whichever lands second just needs the two tests kept.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-11-29 11:20 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/436#pullrequestreview-6102640104) · **reviewed** Ran this on Windows. `cargo test -p victory-hle --lib xasync` gives 17 passed, the new composite test included, and `cargo clippy -p victory-hle --all-targets -D warnings` is clean. The terminate path keeps other owners' tasks in FIFO order, it's all done under the one `port.tasks` lock, and the wake for waiting dispatches still comes after it, so the comment about nobody missing both the flag and the wake still holds. The ids come from a global counter, so a closed queue's id can't come back on a new one sharing the port. Heads-up: it conflicts with your #348, but only at the end of `mod tests`, where both append a test. Whichever lands second just needs the two tests kept. AI-assisted: yes
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-29 11:35 UTC · original

Thanks for checking FIFO order, owner isolation and the wake path. Keep both regression tests when reconciling the overlap with #348; the cancellation-generation fix and composite-queue termination fix should remain independently testable.

**@⁠TaynanGT** on GitHub · 2026-11-29 11:35 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/436#issuecomment-7255214414) Thanks for checking FIFO order, owner isolation and the wake path. Keep both regression tests when reconciling the overlap with #348; the cancellation-generation fix and composite-queue termination fix should remain independently testable.
github-bot closed this pull request 2026-11-30 17:08:42 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:07 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:07 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/436#issuecomment-7285748411) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.