Task queues: terminating cancels delayed callbacks before the termination callback #54
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!54
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/54/head"
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?
@gefydev on GitHub · 2026-11-22 22:46 UTC · original
gefydev:taskqueue-terminate-delayed→main· +35 −0 · 1 files · 1 commits · merged 2026-11-23 09:44 UTCXTaskQueueTerminate(taskqueue.rs) cancels the callbacks queued on the queue's ports, but not delayed callbacks (XTaskQueueSubmitDelayedCallback, also used byXAsyncSchedulewith a delay) that are still waiting in the timer heap. Those only count ininflightonce they are due. So the wait inTerminatedoesn't hold the termination callback for them: it runs first, and the delayed callback runs later, canceled, up to its full delay after the queue was terminated. A title often frees in the termination callback what it passed as those callbacks' context.libHttpClient moves a terminating port's pending delayed entries to its active list (
CancelPendingEntries(cxt, true)inTaskQueuePortImpl::Terminate), so they are invoked canceled before termination completes.Terminatenow takes the queue's entries out of the timer heap and invokes them canceled before the termination callback, the same way it already handles the port items. Delayed callbacks of other queues stay in the heap.Validation
terminate_cancels_delayed_callbacks_before_its_own_callback: a 60 s delayed callback, thenTerminate(wait = true)with a termination callback. Onmainonly["terminated"]is recorded; with the change it is["delayed, canceled", "terminated"].cargo test -p xcl --lib: 340 passed, 0 failed, on Windows GNU under Wine.@ivall on GitHub · 2026-11-23 09:45 UTC · original
Merged (
2e000cb). The module comment oftaskqueue.rsnow describes termination as it is after this and #57 (e38cb65).Tested on Windows 11 (RX 9070):
cargo test --workspacegreen (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!