Repository navigation
hle: bind queued async work to its original call - #80
Conversation
fogydes
left a comment
There was a problem hiding this comment.
Reviewed exact head 2a2d121 with an independent source review and the current-head CI logs. No correctness blocker found within the agreed queued-work identity prerequisite for #42. Capturing Weak prevents stale queued work from resolving a reused caller address; completing the captured Call also preserves the replacement after inline callback reuse. Task-owned context survives dispatch and is released on rejection/disposal without creating the future Call/Queue cycle. The additional state check releases its lock before provider entry. CI confirms all 20 XAsync tests, 204 HLE unit tests and eight integration tests passed, including the three new regressions. All current PR checks are green. Local contributor stress results were not independently rerun. Provider admission versus cleanup, cooperative cancellation and provider-private/public completion ordering remain explicitly deferred to #42; this approval does not treat those existing races as solved. AI assistance: Codex performed source review and inspected existing CI evidence.
What and why
Prerequisite for #42
Queued async work currently resolves its provider by block address when dispatched. After completion and address reuse, old work can invoke or cancel the newer call. A work callback that completes inline can also let its return value complete the replacement call.
Capture the original call through a weak reference in a task-owned context and complete that call directly. Completed or expired calls are skipped. Context ownership ends on dispatch, canceled delivery, rejected submission or queue disposal. Weak ownership avoids a Call/Queue/Task cycle when #42 introduces runtime-owned provider state.
Only
crates/xtp-hle/src/modules/xasync.rschanges: 342 changed lines (+331/-11), comprising 51 production (+40/-11) and 291 test (+291/-0). Provider admission/cleanup ordering and completion-queue ownership remain separate contributions. Existing #30/#44 waiting behavior is preserved.Fixes: none
Depends on: none
Area
xtp-hle: XAsyncSchedule work identity and queued context lifetime.Tests
cargo xtask pr-checkpasses on my machineNative Windows x64, pinned Rust 1.98.1; base
9b822f58870e351613666129ca5621c6a4955fb7.cargo xtask pr-check --title "hle: bind queued async work to its original call": 5/6 passed (fmt, clippy, clippy-diagnostics, policy, conventions). Workspace tests fail only in the two GPU tests below; the proposed title passes. No contribution commit exists yet, so the commit convention check covered zero commits.cargo test --workspace --locked --no-fail-fast: 1,668 passed, 2 failed, 69 ignored, including doctests. Onlyxtp-gpu --libfailed.host::twins::tests::a_24_bit_plane_copied_in_a_query_holds_what_the_pass_draws_for_floats(same 1,412 float differences) andhost::twins::tests::a_pass_leaves_no_scissor_where_the_title_set_none(intermittent; reproduced in the first repeat). Clean baseline GPU runs: 632 passed/1 failed/14 ignored, then 631 passed/2 failed/14 ignored. No GPU code or assertions were modified.Provenance
Original Rust implementation and synthetic fixtures for XTP. Adapted the applicable task-context ownership pattern and callback-reuse regression from the earlier local XTP contribution
0d455a115e9874585099557410aa0deb52fdb883; replaced its strong call capture with a weak reference. No external implementation code was copied or translated. Maintainer scope approval: #42 (comment).AI assistance: OpenAI Codex implemented the change and tests, reviewed ownership paths, ran validation, and prepared this description. The contributor remains responsible for every line.
Checklist
<area>: <summary>; one topic; under 400 changed lines, or the reason is aboveNo command, environment-variable or public API changes require additional documentation; the local ownership contract is documented beside the implementation. No commit has been created yet.