Skip to content

XGameRuntime: dispatch serialized task-queue work on the caller - #3029

Draft
Longno242 wants to merge 1 commit into
xcl-dev:mainfrom
Longno242:xgrt-serialized-dispatch
Draft

Longno242 wants to merge 1 commit into
xcl-dev:mainfrom
Longno242:xgrt-serialized-dispatch

Conversation

@Longno242

Copy link
Copy Markdown

Fixes #2948.

XTaskQueueDispatch returned false for a SerializedThreadPool port even when a callback was queued. The Windows runtime runs that callback on the caller. Claim one queued item the same way a manual port does, and leave the pool worker to drain the rest one at a time.

What is in it

  • crates/xcl/src/hle/xgameruntime/taskqueue.rs: serialized ports share the manual queue path, dispatch accepts that mode, and a test that one explicit call runs the next callback on the caller

Tested

  • Windows 11, debug, cargo test -p xcl --lib hle::xgameruntime::taskqueue::tests -- --test-threads=4: 11 passed, 0 failed

Regression run

  • Not run: no Xbox Series package. Needed before merge because crates/xcl/src outside tests changed.

Not tested

  • full cargo test --workspace
  • scripts/smoke.ps1 on a retail title
  • a live libHttpClient workload

AI use

XTaskQueueDispatch returned false for a SerializedThreadPool port even when a callback was queued. The Windows runtime runs that callback on the caller, so claim one queued item the same way a manual port does and leave the pool worker to drain the rest.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 2b2e0a3

Fixes #2948; the earlier #2806 with the same change is closed and nothing on main does it. The diff matches the issue's native-runtime observation (an explicit XTaskQueueDispatch on a SerializedThreadPool port claims one queued callback on the caller, the worker keeps draining the rest), and the test pins exactly that. No problems found in the diff; it conflicts with main's later taskqueue.rs changes (#1154 and others) and needs a rebase.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 2b2e0a3, diff read, not a merge-check; draft, conflicts with main, PR description red):

  • "One at a time" no longer holds once a title calls dispatch. The test (taskqueue.rs ~835) pins the second callback running on the caller while the worker is still inside the first. XTaskQueueDispatch returns false with work queued on a SerializedThreadPool port #2948 reports one Windows xgameruntime.dll version doing exactly this. Whether the console runtime and libHttpClient expect it isn't shown; a title log of a serialized port being dispatched would back it.
  • A behaviour change with a timeout: dispatch on a serialized port now blocks where it used to return false at once.
  • Rebase hazard (~300-316): main's XGameRuntime: a task queue's termination callback runs on its completion port #1154 added the terminating path (pending termination-callback count, notify_all) to both the serialized and manual branches, and the rebased branch has to keep it.

Fine: no deadlock inside XCL. dispatch drops its lock before running the callback, and terminate wakes waiters on both ports. A title holding a lock its own callback needs would hang the same way in Manual mode.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XTaskQueueDispatch returns false with work queued on a SerializedThreadPool port

2 participants