xtaskqueue: preserve other work on shared ports #403
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/403"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T02:57:25Z.
AI-assisted.
Problem
Composite
XTaskQueueinstances created viaXTaskQueueCreateCompositeshare underlyingPortobjects, butXTaskQueueTerminatedrained all pending tasks from every port on the terminating queue — canceling callbacks queued by other live queues sharing the same port. In addition, a delayed callback already accepted before termination could still be pushed onto a shared port afterterminatedwas set.Fix
PendingTaskentries with the owning queue'sArc<AtomicBool>cancellation flag.Port::submit, checkowner.load(Ordering::Acquire)under the port lock and immediately run late deliveries as canceled instead of enqueueing them.XTaskQueueTerminate, retain tasks owned by other queues on shared ports and cancel only tasks belonging to the terminating queue.modules::xasync::tests::terminating_one_queue_keeps_other_work_on_the_shared_port.Verification
cargo xtask policy:151 files okcargo test -p victory-hle xasync:6 passed; 0 failedcargo clippy -p victory-hle --all-targets: 0 warnings inxasync.rsImported from Marvisak/VIctory. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T02:57:36Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T06:28:13Z.
Review: APPROVED
Tested
4ee6efaon Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (265 passed, 0 failed), includingterminating_one_queue_keeps_other_work_on_the_shared_port.terminatedflag.XTaskQueueTerminatecancels only the entries whose flag is its own (Arc::ptr_eq), so a composite queue's work on a shared port survives another queue's termination.submitchecks the flag under the port lock, so a delivery that races with terminate is either queued before the drain or run as canceled. It can't land on the port afterwards.falsethere also keeps monitors from being told about a task that was never queued.ImmediateandThreadPoolports ignore the flag, as before. Those never held queued tasks to cancel.No issues found.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:31:59Z.
Thanks @lordon1a for keeping shared-port work independent across queue termination. I tested head
4ee6efa4a0c686d1def48c4bfebd45caa0aa9d75with:Result: 1 passed, 0 failed (86 filtered out). The test terminates one async queue while another queue has work on the shared port and verifies the other work still completes. This is a synthetic XAsync test, not a title workflow.
Pull request closed