gdk rt: XTaskQueueRegisterWaiter and UnregisterWaiter, two-phase queue termination (5 conformance scenarios) #270

Closed
github-bot wants to merge 2 commits from gh-pr/270/head into gh-pr/270/base
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 09:17 UTC · original
QuentinDanblon:pr/xtq-register-waiter → main · +351 −43 · 4 files · 2 commits · closed without merging

Library / area: compat-common, GDK runtime task queues (src/gdk/rt.rs), conformance table (tests/gdk_xtaskqueue_conformance.rs)

Exports changed (exports.txt rows): none. Two slots of the XAsync interface change: slot 20 XTaskQueueRegisterWaiter and slot 21 XTaskQueueUnregisterWaiter were the E_NOTIMPL stub.

Source of the behaviour: libHttpClient Source/Task/TaskQueue.cpp at c5007fd9 (MIT): TaskQueueImpl::RegisterWaitHandle, UnregisterWaitHandle, Terminate and OnTerminationCallback, TaskQueuePortImpl::RegisterWaitHandle, UnregisterWaitHandle, ProcessWaitCallback, DrainOneItem and CancelPendingEntries. The rules were followed and rewritten in Rust, no code copied. The libHttpClient line of THIRD_PARTY/CREDITS is extended. The termination order was measured on the PC xgameruntime.dll 10.0.26100.9656.

Rebased onto de1e1da (r32j). Two commits, nothing of #266 left:

  • 8493396 RegisterWaiter and UnregisterWaiter, the same change as before the rebase.
  • cf2a326 termination order, new, asked in review.

What 8493396 does

  • XTaskQueueRegisterWaiter registers a Win32 thread-pool wait on the handle. Each time the handle is signalled, the callback is submitted once to the requested port. The wait is armed again only after that callback has run: an auto-reset event gives one callback per SetEvent, a manual-reset event left signalled gives a callback again after each one.
  • Argument checks as the reference: E_POINTER for a null callback or token, E_INVALIDARG for a bad port, a null handle or a handle that is not a queue, E_ABORT on a terminated queue.
  • XTaskQueueUnregisterWaiter removes the registration, stops the wait and waits for a wait callback that is still queuing its entry. An entry already queued still runs, as in the reference.
  • Terminating a queue drops its registrations and queues one canceled callback for each registration that has no entry pending. Closing the last handle drops them without a callback. Only registrations made through that queue are touched, so on a shared port the other queue's waiters keep working.
  • Termination has two phases, as TaskQueueImpl::Terminate: the work port refuses new work at once, the completion port keeps accepting callbacks until the termination marker of the work port has run. verify_queue_termination and verify_termination_of_composite_queue need this.

What cf2a326 does

Measured on the PC runtime with a manual queue that holds one queued and one delayed callback on each port:

step PC runtime
submit right after XTaskQueueTerminate work E_ABORT, completion S_OK
callbacks canceled before any dispatch none
work port dispatched queued work, then delayed work, both canceled
submit once the work port has drained work E_ABORT, completion E_ABORT
completion port dispatched the queued callback, the one submitted after terminate, the delayed one, all canceled, then the termination callback
submit after the termination callback E_ABORT on both ports

Our runtime differed on two lines. Once the work port had drained, the completion port still returned S_OK and ran that callback. And the delayed completion callback came before the one submitted after terminate.

The cause was one count of callbacks in flight for both ports: the termination marker of the work port waited for the completion callbacks too. The count is now kept per port. The work port ends first and its delayed callbacks are queued, canceled, behind the callbacks already queued on it. When it holds no callback of the queue any more, the completion port refuses new callbacks and its delayed callbacks are queued the same way. The termination callback runs after the last of them.

New scenario verify_termination_order_on_a_manual_queue checks every line of the table. verify_termination_cancels_delayed_callbacks (already there) covers a delayed work callback on a thread-pool queue and on a manual queue.

Both commits change the path of every queue termination, not only of queues with waiters.

Rows removed from DIFFERS (5, 14 remain)

verify_queue_termination, verify_register_with_auto_reset, verify_shared_port_queue_rundown_drops_its_wait_handles, verify_shared_port_queue_rundown_keeps_other_waiters, verify_termination_of_composite_queue. All by 8493396. cf2a326 removes none: I ran verify_termination_of_base_queue_keeps_composites, verify_terminate_waits_for_async_in_flight and verify_close_keeps_queued_callbacks with TOMBOX_XTQ_ALL=1 and they still fail.

Tests

On cf2a326, RTX 5090 PC, Windows 11:

  • cargo test -p compat-common --release --test gdk_xtaskqueue_conformance_real (same scenarios against the real xgameruntime.dll): 62 passed. The three scenarios of NEWER_THAN_RUNTIME return at once there, among them the two verify_shared_port_queue_rundown_*.
  • --test gdk_xtaskqueue_conformance: 5 runs, 62 passed each (the 14 DIFFERS rows return at once).
  • --lib: 4 runs. 3 runs: 149 passed. 1 run: 148 passed, 1 failed, os_host::tm_race_probe::tests::the_scan_finds_objects_by_their_vtable at tm_race_probe.rs:317 (new in r32j, not touched here). For comparison, 8 --lib runs on plain de1e1da: 6 passed, 2 failed in iat::tests::finds_the_bound_slot_of_an_import_of_this_binary at iat.rs:81.
  • pr_gate.py --base origin/main: 0 problems.
  • Before the rebase, on 68ba2a5: 10 conformance runs, the five scenarios alone 5 times each with TOMBOX_XTQ_ALL=1, 3 --lib runs, all passed.

Not run green: cargo test -p compat-common --release as a whole stops at tests/gdk_fs_redirect.rs (new in r32j), which ends with STATUS_STACK_OVERFLOW on this PC. Plain de1e1da does the same here, 2 runs of 2, so it does not come from this PR.

Not covered, not claimed

  • No title was run. I have no game dump.

  • A wait that ends with a result other than WAIT_OBJECT_0 (an abandoned mutex) is not delivered and the wait is not armed again. The registration stays until it is unregistered or the queue ends. I did not check what the reference does there.

  • The handle is not duplicated. The title must keep it open while it is registered. I did not check whether the console runtime duplicates it.

  • The race I fixed in review has no test of its own: a wait callback that fires during termination and cannot queue its entry now still gets its canceled callback (close reads the pending flag after it has waited for the wait callbacks). I found it by reading, not by a failing run.

  • The termination order is measured on manual ports only. On thread-pool and serialized ports the same code runs, and the existing termination scenarios pass, but the order itself is not asserted there.

  • Whether a completion callback dispatched after XTaskQueueTerminate and before the work port has drained runs canceled on the PC runtime is not measured. Ours runs it canceled, as before.

  • docs/BLOCKERS.md line "25 libHttpClient-derived scenarios differ" is yours, I did not touch it. The count is 14.

  • cargo test -p compat-common passes for what is listed above

  • No game or console files and no binaries included

  • No fake success; anything not possible is left missing with a note

🤖 Generated with Claude Code

**@⁠QuentinDanblon** on GitHub · 2026-11-23 09:17 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270) `QuentinDanblon:pr/xtq-register-waiter` → `main` · +351 −43 · 4 files · 2 commits · closed without merging **Library / area:** `compat-common`, GDK runtime task queues (`src/gdk/rt.rs`), conformance table (`tests/gdk_xtaskqueue_conformance.rs`) **Exports changed (exports.txt rows):** none. Two slots of the XAsync interface change: slot 20 `XTaskQueueRegisterWaiter` and slot 21 `XTaskQueueUnregisterWaiter` were the `E_NOTIMPL` stub. **Source of the behaviour:** libHttpClient `Source/Task/TaskQueue.cpp` at `c5007fd9` (MIT): `TaskQueueImpl::RegisterWaitHandle`, `UnregisterWaitHandle`, `Terminate` and `OnTerminationCallback`, `TaskQueuePortImpl::RegisterWaitHandle`, `UnregisterWaitHandle`, `ProcessWaitCallback`, `DrainOneItem` and `CancelPendingEntries`. The rules were followed and rewritten in Rust, no code copied. The libHttpClient line of `THIRD_PARTY/CREDITS` is extended. The termination order was measured on the PC `xgameruntime.dll` 10.0.26100.9656. **Rebased onto `de1e1da` (r32j).** Two commits, nothing of #266 left: - `8493396` RegisterWaiter and UnregisterWaiter, the same change as before the rebase. - `cf2a326` termination order, new, asked in review. ### What `8493396` does - `XTaskQueueRegisterWaiter` registers a Win32 thread-pool wait on the handle. Each time the handle is signalled, the callback is submitted once to the requested port. The wait is armed again only after that callback has run: an auto-reset event gives one callback per `SetEvent`, a manual-reset event left signalled gives a callback again after each one. - Argument checks as the reference: `E_POINTER` for a null callback or token, `E_INVALIDARG` for a bad port, a null handle or a handle that is not a queue, `E_ABORT` on a terminated queue. - `XTaskQueueUnregisterWaiter` removes the registration, stops the wait and waits for a wait callback that is still queuing its entry. An entry already queued still runs, as in the reference. - Terminating a queue drops its registrations and queues one canceled callback for each registration that has no entry pending. Closing the last handle drops them without a callback. Only registrations made through that queue are touched, so on a shared port the other queue's waiters keep working. - Termination has two phases, as `TaskQueueImpl::Terminate`: the work port refuses new work at once, the completion port keeps accepting callbacks until the termination marker of the work port has run. `verify_queue_termination` and `verify_termination_of_composite_queue` need this. ### What `cf2a326` does Measured on the PC runtime with a manual queue that holds one queued and one delayed callback on each port: | step | PC runtime | |---|---| | submit right after `XTaskQueueTerminate` | work `E_ABORT`, completion `S_OK` | | callbacks canceled before any dispatch | none | | work port dispatched | queued work, then delayed work, both canceled | | submit once the work port has drained | work `E_ABORT`, completion `E_ABORT` | | completion port dispatched | the queued callback, the one submitted after terminate, the delayed one, all canceled, then the termination callback | | submit after the termination callback | `E_ABORT` on both ports | Our runtime differed on two lines. Once the work port had drained, the completion port still returned `S_OK` and ran that callback. And the delayed completion callback came before the one submitted after terminate. The cause was one count of callbacks in flight for both ports: the termination marker of the work port waited for the completion callbacks too. The count is now kept per port. The work port ends first and its delayed callbacks are queued, canceled, behind the callbacks already queued on it. When it holds no callback of the queue any more, the completion port refuses new callbacks and its delayed callbacks are queued the same way. The termination callback runs after the last of them. New scenario `verify_termination_order_on_a_manual_queue` checks every line of the table. `verify_termination_cancels_delayed_callbacks` (already there) covers a delayed work callback on a thread-pool queue and on a manual queue. Both commits change the path of every queue termination, not only of queues with waiters. ### Rows removed from `DIFFERS` (5, 14 remain) `verify_queue_termination`, `verify_register_with_auto_reset`, `verify_shared_port_queue_rundown_drops_its_wait_handles`, `verify_shared_port_queue_rundown_keeps_other_waiters`, `verify_termination_of_composite_queue`. All by `8493396`. `cf2a326` removes none: I ran `verify_termination_of_base_queue_keeps_composites`, `verify_terminate_waits_for_async_in_flight` and `verify_close_keeps_queued_callbacks` with `TOMBOX_XTQ_ALL=1` and they still fail. ### Tests On `cf2a326`, RTX 5090 PC, Windows 11: - `cargo test -p compat-common --release --test gdk_xtaskqueue_conformance_real` (same scenarios against the real `xgameruntime.dll`): 62 passed. The three scenarios of `NEWER_THAN_RUNTIME` return at once there, among them the two `verify_shared_port_queue_rundown_*`. - `--test gdk_xtaskqueue_conformance`: 5 runs, 62 passed each (the 14 `DIFFERS` rows return at once). - `--lib`: 4 runs. 3 runs: 149 passed. 1 run: 148 passed, 1 failed, `os_host::tm_race_probe::tests::the_scan_finds_objects_by_their_vtable` at `tm_race_probe.rs:317` (new in r32j, not touched here). For comparison, 8 `--lib` runs on plain `de1e1da`: 6 passed, 2 failed in `iat::tests::finds_the_bound_slot_of_an_import_of_this_binary` at `iat.rs:81`. - `pr_gate.py --base origin/main`: 0 problems. - Before the rebase, on `68ba2a5`: 10 conformance runs, the five scenarios alone 5 times each with `TOMBOX_XTQ_ALL=1`, 3 `--lib` runs, all passed. Not run green: `cargo test -p compat-common --release` as a whole stops at `tests/gdk_fs_redirect.rs` (new in r32j), which ends with `STATUS_STACK_OVERFLOW` on this PC. Plain `de1e1da` does the same here, 2 runs of 2, so it does not come from this PR. ### Not covered, not claimed - No title was run. I have no game dump. - A wait that ends with a result other than `WAIT_OBJECT_0` (an abandoned mutex) is not delivered and the wait is not armed again. The registration stays until it is unregistered or the queue ends. I did not check what the reference does there. - The handle is not duplicated. The title must keep it open while it is registered. I did not check whether the console runtime duplicates it. - The race I fixed in review has no test of its own: a wait callback that fires during termination and cannot queue its entry now still gets its canceled callback (`close` reads the pending flag after it has waited for the wait callbacks). I found it by reading, not by a failing run. - The termination order is measured on manual ports only. On thread-pool and serialized ports the same code runs, and the existing termination scenarios pass, but the order itself is not asserted there. - Whether a completion callback dispatched after `XTaskQueueTerminate` and before the work port has drained runs canceled on the PC runtime is not measured. Ours runs it canceled, as before. - `docs/BLOCKERS.md` line "25 libHttpClient-derived scenarios differ" is yours, I did not touch it. The count is 14. - [x] `cargo test -p compat-common` passes for what is listed above - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XTaskQueueRegisterWaiter (XAsync interface slot 20) used to fall through
to the E_NOTIMPL stub. It now registers a Win32 thread-pool wait on the
handle. Each time the handle is signalled, the callback is submitted once
to the requested port of the queue. The wait is re-armed only after that
callback has run, so an auto-reset event fires once per SetEvent and a
manual-reset event left signalled fires again after each callback.
Argument checks follow libHttpClient: E_POINTER for a null callback or
token, E_INVALIDARG for a bad port or a null handle, E_ABORT on a
terminated queue.

XTaskQueueUnregisterWaiter (slot 21) removes the registration of that
queue, stops the thread-pool wait and waits for a callback that is still
appending its entry before it closes the wait. An entry already queued
still runs, as in the reference.

Termination drops the terminated queue's registrations and queues one
canceled callback for each registration that has no entry pending.
Closing the last handle of a queue drops its registrations without a
callback. Both only touch the registrations made through that queue
handle, so on a shared port the other queue's waiters keep working.

Termination now runs in two phases like libHttpClient's
TaskQueueImpl::Terminate: the work port stops accepting work at once,
while the completion port still accepts (canceled) callbacks until the
work port's termination marker has run. Canceled work callbacks can
therefore submit their completion, which verify_queue_termination and
verify_termination_of_composite_queue require.

Source: behaviour of libHttpClient (github.com/microsoft/libHttpClient,
MIT) Source/Task/TaskQueue.cpp: TaskQueueImpl::RegisterWaitHandle,
UnregisterWaitHandle and Terminate, TaskQueuePortImpl::RegisterWaitHandle,
UnregisterWaitHandle, ProcessWaitCallback, DrainOneItem (re-arm after the
callback) and CancelPendingEntries. Reimplemented in Rust, no code copied.

Tested: verify_queue_termination, verify_register_with_auto_reset,
verify_shared_port_queue_rundown_drops_its_wait_handles,
verify_shared_port_queue_rundown_keeps_other_waiters and
verify_termination_of_composite_queue now pass and leave the DIFFERS
table. Three of them also pass against the PC xgameruntime.dll; the two
shared-port scenarios are skipped there as newer than the runtime. Two
unit tests in rt.rs cover a manual-reset event and a waiter that
unregisters itself from an immediate-port callback.

Still different: the 14 rows left in DIFFERS are unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
XTaskQueueTerminate kept one count of callbacks in flight for both
ports. The termination marker of the work port therefore waited for the
completion callbacks too, and two things differed from xgameruntime.dll:

- the completion port still accepted callbacks after the work port had
  drained, until every completion callback had run;
- delayed completion callbacks were queued (canceled) at the time of
  XTaskQueueTerminate, ahead of completion callbacks submitted after it.

The count is now kept per port:

- XTaskQueueTerminate: the work port refuses new callbacks at once and
  its delayed callbacks are queued, canceled, behind the callbacks
  already queued on it. The completion port still accepts.
- When the work port holds no callback of the queue any more, its
  termination marker runs. From then on the completion port refuses new
  callbacks, and its delayed callbacks are queued, canceled, behind the
  callbacks already queued on it.
- The termination callback runs on the completion port after the last
  of them.

Delayed callbacks now record which port of the queue they wait for.

New scenario verify_termination_order_on_a_manual_queue: a manual queue
with one queued and one delayed callback on each port is terminated,
callbacks are submitted after XTaskQueueTerminate and again after the
work port has drained. It checks the return code of every late submit
(E_ABORT, S_OK on the completion port only before the work port has
drained), that nothing is canceled before its port is dispatched, and
the order in which the callbacks and the termination callback run. The
expected values were measured on xgameruntime.dll 10.0.26100.9656
(gdk_xtaskqueue_conformance_real) before the change; our runtime
differed on both points above.

The 14 rows of DIFFERS are unchanged.

Source: measured behaviour of the PC xgameruntime.dll; the per-port
termination follows libHttpClient (github.com/microsoft/libHttpClient
@c5007fd9, MIT) Source/Task/TaskQueue.cpp, TaskQueueImpl::Terminate,
OnTerminationCallback and TaskQueuePortImpl::CancelPendingEntries.
Reimplemented in Rust, no code copied.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:16:41 +00:00
github-bot closed this pull request 2026-11-26 06:16:41 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 09:41 UTC · original

#266 is now on main (e3c62b7), so please rebase #270 onto main so that only the RegisterWaiter/UnregisterWaiter commit remains. Because it changes the task-queue path Trackmania uses at boot, it gets its own full-boot Trackmania check before it can go into a release.

**@⁠omonkeyz** on GitHub · 2026-11-23 09:41 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270#issuecomment-7096982322) #266 is now on main (e3c62b7), so please rebase #270 onto main so that only the RegisterWaiter/UnregisterWaiter commit remains. Because it changes the task-queue path Trackmania uses at boot, it gets its own full-boot Trackmania check before it can go into a release.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 09:46 UTC · original

One behaviour question to settle alongside the rebase. After a Begin whose operation fails, what does XAsyncGetStatus report for the call? And if Begin returns E_PENDING, is the call left incomplete? Could you add a conformance case for each? The termination order matters too: delayed callbacks should be cancelled before the termination callback runs, and a terminated queue should take no new work. Please cover those in the two-phase termination tests.

**@⁠omonkeyz** on GitHub · 2026-11-23 09:46 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270#issuecomment-7097068998) One behaviour question to settle alongside the rebase. After a Begin whose operation fails, what does XAsyncGetStatus report for the call? And if Begin returns E_PENDING, is the call left incomplete? Could you add a conformance case for each? The termination order matters too: delayed callbacks should be cancelled before the termination callback runs, and a terminated queue should take no new work. Please cover those in the two-phase termination tests.
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 10:28 UTC · original

Rebased onto de1e1da (r32j). Nothing of #266 is left. The branch holds two commits: 8493396, the RegisterWaiter/UnregisterWaiter commit, and cf2a326, new, for the termination order you asked about. The description above is rewritten for this state.

All answers below were measured on the PC xgameruntime.dll 10.0.26100.9656 with gdk_xtaskqueue_conformance_real, then compared with ours.

After a Begin whose op fails. XAsyncBegin returns S_OK. XAsyncGetStatus(wait = false) returns the Begin failure as soon as XAsyncBegin has returned, and so does XAsyncGetResultSize. No work is queued. The completion callback is queued on the completion port and reads the same status. Ours already did this. Two things next to it differed: the PC runtime runs the Cleanup op after the completion callback when the call is completed during Begin (we ran it at once), and XAsyncSchedule on the failed call returns the failure (we returned S_OK or E_INVALIDARG). That is XAsync and not task queues, so it is in its own PR with two scenarios: #271.

Begin returning E_PENDING. The PC runtime leaves the call incomplete: status E_PENDING, no work, no completion callback, no Cleanup, and the call can still be scheduled and completed afterwards. Ours completed it. That defect came from my #266 (if hr < 0 in begin). You fixed it in r32j with verify_pending_begin_stays_pending; I dropped my copy of the fix and my scenario.

Termination order. New scenario verify_termination_order_on_a_manual_queue, table in the description. On the PC runtime the delayed callbacks of a port are canceled when that port is dispatched, after the callbacks already queued on it and before the termination callback. The work port refuses new callbacks from XTaskQueueTerminate on. The completion port refuses them once the work port has drained, and both refuse after the termination callback. Ours differed on two points: the completion port still accepted a callback after the work port had drained, and it canceled its delayed callback ahead of a callback submitted after terminate. cf2a326 fixes both by counting the callbacks in flight per port.

cf2a326 changes every queue termination again, so it belongs in the same full-boot Trackmania check as the first commit. I have no game dump and ran no title.

Two things seen on plain de1e1da on this PC (Windows 11 26300, RTX 5090), not caused by either PR:

  • cargo test -p compat-common --release --test gdk_fs_redirect ends with STATUS_STACK_OVERFLOW in copy_move_and_replace_calls_follow_the_console_path_like_create_file, 2 runs of 2.
  • cargo test -p compat-common --release --lib: 2 runs of 8 fail in iat::tests::finds_the_bound_slot_of_an_import_of_this_binary (iat.rs:81). On the #270 branch 1 run of 4 failed in os_host::tm_race_probe::tests::the_scan_finds_objects_by_their_vtable (tm_race_probe.rs:317).

I did not look for the causes. Tell me if you want the full output.

**@⁠QuentinDanblon** on GitHub · 2026-11-23 10:28 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270#issuecomment-7098027990) Rebased onto `de1e1da` (r32j). Nothing of #266 is left. The branch holds two commits: `8493396`, the RegisterWaiter/UnregisterWaiter commit, and `cf2a326`, new, for the termination order you asked about. The description above is rewritten for this state. All answers below were measured on the PC `xgameruntime.dll` 10.0.26100.9656 with `gdk_xtaskqueue_conformance_real`, then compared with ours. **After a Begin whose op fails.** `XAsyncBegin` returns `S_OK`. `XAsyncGetStatus(wait = false)` returns the Begin failure as soon as `XAsyncBegin` has returned, and so does `XAsyncGetResultSize`. No work is queued. The completion callback is queued on the completion port and reads the same status. Ours already did this. Two things next to it differed: the PC runtime runs the Cleanup op after the completion callback when the call is completed during Begin (we ran it at once), and `XAsyncSchedule` on the failed call returns the failure (we returned `S_OK` or `E_INVALIDARG`). That is XAsync and not task queues, so it is in its own PR with two scenarios: #271. **Begin returning `E_PENDING`.** The PC runtime leaves the call incomplete: status `E_PENDING`, no work, no completion callback, no Cleanup, and the call can still be scheduled and completed afterwards. Ours completed it. That defect came from my #266 (`if hr < 0` in `begin`). You fixed it in r32j with `verify_pending_begin_stays_pending`; I dropped my copy of the fix and my scenario. **Termination order.** New scenario `verify_termination_order_on_a_manual_queue`, table in the description. On the PC runtime the delayed callbacks of a port are canceled when that port is dispatched, after the callbacks already queued on it and before the termination callback. The work port refuses new callbacks from `XTaskQueueTerminate` on. The completion port refuses them once the work port has drained, and both refuse after the termination callback. Ours differed on two points: the completion port still accepted a callback after the work port had drained, and it canceled its delayed callback ahead of a callback submitted after terminate. `cf2a326` fixes both by counting the callbacks in flight per port. `cf2a326` changes every queue termination again, so it belongs in the same full-boot Trackmania check as the first commit. I have no game dump and ran no title. Two things seen on plain `de1e1da` on this PC (Windows 11 26300, RTX 5090), not caused by either PR: - `cargo test -p compat-common --release --test gdk_fs_redirect` ends with `STATUS_STACK_OVERFLOW` in `copy_move_and_replace_calls_follow_the_console_path_like_create_file`, 2 runs of 2. - `cargo test -p compat-common --release --lib`: 2 runs of 8 fail in `iat::tests::finds_the_bound_slot_of_an_import_of_this_binary` (`iat.rs:81`). On the #270 branch 1 run of 4 failed in `os_host::tm_race_probe::tests::the_scan_finds_objects_by_their_vtable` (`tm_race_probe.rs:317`). I did not look for the causes. Tell me if you want the full output.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 13:45 UTC · original

Applied locally on main with your authorship kept (cherry-picked, d39a963); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 13:45 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270#issuecomment-7102983412) Applied locally on main with your authorship kept (cherry-picked, d39a963); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 18:08 UTC · original

Cross-check with #307 and with microsoft/libHttpClient (MIT), which ships a full XTaskQueue implementation: the two-phase termination table here matches the reference code, and the two points I had left unverified are confirmed there (waiter handle not duplicated; a wait result other than WAIT_OBJECT_0 is ignored and not rearmed). Details, line links and a proposed merge order with #307 are in the #307 thread.

**@⁠QuentinDanblon** on GitHub · 2026-11-23 18:08 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270#issuecomment-7109706018) Cross-check with #307 and with microsoft/libHttpClient (MIT), which ships a full XTaskQueue implementation: the two-phase termination table here matches the reference code, and the two points I had left unverified are confirmed there (waiter handle not duplicated; a wait result other than WAIT_OBJECT_0 is ignored and not rearmed). Details, line links and a proposed merge order with #307 are in the #307 thread.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:09 UTC · original

Applied on main in d39a963 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:09 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/270#issuecomment-7163371684) Applied on main in d39a963 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.