Repository navigation
XGameRuntime: honor wait/cancel in device association unregister (#1389) - #1583
hajduzsolt wants to merge 2 commits into
Conversation
|
Reviewed the interleavings rather than the shape — this is correct, including the case that kills most removal-wait patterns:\n\n- fire-before-unregister: shim locks state, passes |
…-dev#1389) association_call previously ignored task-queue cancellation and invoked the callback even after XUserUnregisterForDeviceAssociationChanged returned; XUserUnregisterForDeviceAssociationChanged ignored wait, and USER_SIGNED_IN raced with registration outside the mutex. Track per-registration stopped/in-flight state with Condvar notification, bail on canceled or stopped callbacks, serialize signed_in under the registry lock, and block when wait=true until in-flight callbacks finish. Fixes xcl-dev#1389 Assisted-by: Antigravity (Gemini 4 Hydrogen, high)
dac0255 to
b027c8a
Compare
|
Thanks for calling out the owner invariant. I documented the actual reason: the registry lock makes each registration eligible for exactly one notification, whether it registers before or after sign-in. A single queue alone would not guarantee serialization for thread-pool dispatch. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Two contributors checked independently and found that #1418 #1753 solves the same problem (for #1389) in a different way: #1607, group D58. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
Empirical test report (8e894c5)Hardware / environment
Commands and results
Observed behavior The single unit test passed all three scenarios. Unregistering before dispatch suppressed the queued callback and a second unregister returned false. Queue termination suppressed the canceled callback. With wait enabled, unregister was still pending while the callback was held open and completed after the callback was released. Not tested Coverage was limited to workspace test compilation and the PR's focused CPU test. The full GPU workspace suite and game smoke runs were omitted. AI use Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against |
…cl-dev#1753, Windows verbatim + Linux twin) Windows hle/xgameruntime/mod.rs is the upstream hunk verbatim (reference-only on Linux): AssociationCall gains token + Queued/ Running/Done state + condvar, ASSOCIATION_CALLS liveset tracks in-flight callbacks; association_call skips canceled/non-queued records, unregister marks queued ones Done and with wait=true joins running ones. Upstream test ported verbatim. Linux twin hle/xuser_linux.rs mirrors the same state machine on xtaskqueue_linux (win64 ABI, submit_now bool path) with a Linux-shaped twin test (manual queue + dispatch + token+1 pin). Triage per keeper (land ONE, xcl-dev#1753 preferred): xcl-dev#1583 closes with citation (its +2 is a comment on its own competing stopped/in_flight registry, which stays out); xcl-dev#1418 stays out (Entry/manager + running_threads + unknown-token-false + re-entrant self-skip is the competing design; xcl-dev#1753 keeps the existing always-true unregister).
Fixes use-after-free and sign-in/registration races in XUserRegisterForDeviceAssociationChanged / XUserUnregisterForDeviceAssociationChanged by tracking per-registration stopped and in_flight state with a Condvar and checking canceled in ^Gssociation_call. Fixes #1389.
What is in it
Tested
Regression run
main:
PR:
Not tested
AI use