Repository navigation
Conversation
…ion port XTaskQueueTerminate(wait = false) had a worker of the shared pool call the title's termination callback directly. The GDK docs say the callback "will be invoked from the completion thread at the end of termination", and their example terminates a queue with a manual completion port from WM_CLOSE and calls DestroyWindow in the callback, relying on it running from the UI thread's own XTaskQueueDispatch. libHttpClient likewise queues a termination entry on the completion port and notifies the queue's monitors. Once in-flight work and completions have drained, the callback is now submitted to the completion port through the same path as other completion callbacks (which notifies monitors), allowed past the terminated check. On a manual port it runs from the title's XTaskQueueDispatch, on a thread-pool port on the pool. With wait = true the callback still runs on the calling thread before Terminate returns: on a manual port nobody may dispatch while the caller waits, which the docs warn may deadlock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Upstream PR xcl-dev#1154 was closed or merged. |
ufoptg
pushed a commit
that referenced
this pull request
Nov 27, 2026
Part of xcl-dev#480. Add integration tests comparing D3D12.X runtime wrappers against host ID3D12Device objects and console ABI contracts across: - ID3D12Resource Map, Unmap, GetGPUVirtualAddress (including lazy TITLE_ADDRESS texture fallback and UMA buffer placement), and WriteToSubresource - ID3D12DescriptorHeap console slot #9/#10 start handles and console_heap::start lifecycle on host and console #14 heaps - ID3D12CommandQueue GetDesc, GetTimestampFrequency, GetClockCalibration (host parity and pre/post-QUEUE_OLDER console calls), ExecuteCommandLists, Wait, Signal, and SignalX (#23) - ID3D12Fence slot #12 64-byte-aligned completed-value cell and CPU Signal updates, plus ID3D12CommandAllocator::Reset (#8) Verified on AMD Radeon RX 9070 XT (debug, release, XCL_D3D12_DEBUG=1), AMD Radeon(TM) Graphics, and WARP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XTaskQueueTerminatewithwait = falseran the title's termination callback on XCL's own worker thread, as soon as the queue's work had finished. Microsoft's documentation ofXTaskQueueTerminatesays the callback is invoked from the completion thread at the end of termination. Its example for a manual completion port relies on that: the callback is queued to the completion port, so it already runs on the title's UI thread. A title that dispatches its completion port by hand could get the callback on a thread it does not expect, while that thread may still be touching the queue.Now, with
wait = false, the callback is submitted to the queue's completion port once the pending work and completions are done. The port's monitors are notified, so on a manual port the callback runs from the title's ownXTaskQueueDispatch. Withwait = truethe callback still runs on the calling thread beforeTerminatereturns: queuing it there could hang a caller whose manual port nobody dispatches while it waits.What is in it
crates/xcl/src/hle/xgameruntime/taskqueue.rs:submit_nowgoes through a privatesubmitthat can let the termination entry past the terminated check.run_terminatedruns the queued callback.termination_callback_runs_from_a_manual_completion_port_dispatch.Tested
cargo test --workspace -- --test-threads=4on ea68eaa: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU testsXTaskQueueTerminatefails ("the termination callback ran before the completion port was dispatched"); with it it passes;cargo test -p xcl --lib xgameruntime3 times: 74 passed, 0 failed eachRegression run
main:
this PR:
Not tested
wait = false(the smoke title's run is a regression check only).AI use
🤖 Generated with Claude Code
Mirror of xcl-dev#1154 (auto-synced, do not edit).