Skip to content

Transfer stock async results without cloning - #5489

Merged
Kenny Kerr (kennykerr) merged 1 commit into
masterfrom
future-result-transfer
Nov 25, 2026
Merged

Kenny Kerr (kennykerr) merged 1 commit into
masterfrom
future-result-transfer

Conversation

@kennykerr

Copy link
Copy Markdown
Collaborator

Transfer successful results once from stock ready and spawn operations instead of cloning them under the state lock. This removes the native AddRef reentry deadlock and lets both factories accept Send-only results.

Further value retrieval returns E_ILLEGAL_METHOD_CALL, while status and error information remain available. Progress-interface variants use the same final-result-only contract; they do not produce progress or intermediate results. Native operations consumed through the crate keep their own retrieval behavior.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Windows interop and concurrency tests could not be run, leaving native COM AddRef reentrancy, deadlock prevention, and cross-language ownership guarantees unverified.

No open issues 🎉

What changed in this PR

This PR changes stock windows-future operations to transfer successful results once rather than clone them, avoiding native AddRef reentry deadlocks and allowing Send-only results.

Changes:

  • Share one-time result storage across ready and spawn, preserving status and error information after consumption.
  • Add Rust and C++ interop coverage for clone-free transfer, concurrent retrieval, and result lifetime.
  • Document the retrieval contract and update contributor guidance.
File Description
crates/​tests/​libs/​future/​tests/​agile.rs Tests Send-only, clone-free results and concurrent single-winner retrieval.
crates/​tests/​libs/​future/​src/​lib.rs Updates compile-fail coverage for non-Send results.
crates/​tests/​interop/​fixtures/​async_methods/​handlers.h Adds native result-transfer, reentry, and lifetime checks.
crates/​tests/​interop/​fixtures/​async_methods/​component.rs Implements result-returning interop fixture methods.
crates/​tests/​interop/​fixtures/​async_methods/​api.rdl Declares the new interop fixture methods.
crates/​libs/​future/​src/​async.rs Introduces shared one-time result storage.
crates/​libs/​future/​src/​async_spawn.rs Separates spawned results from the completion-handler mutex.
crates/​libs/​future/​src/​async_ready.rs Transfers ready results once and removes the Sync requirement.
crates/​libs/​future/​readme.md Documents result consumption and retained status/error access.
.github/​copilot-instructions.md Records stock async result ownership and locking conventions.

Review effort: Balanced

@kennykerr
Kenny Kerr (kennykerr) merged commit f6e186c into master Nov 25, 2026
51 of 52 checks passed
@kennykerr
Kenny Kerr (kennykerr) deleted the future-result-transfer branch November 25, 2026 13:32
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.

2 participants