Repository navigation
Transfer stock async results without cloning - #5489
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🔵 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
readyandspawn, 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Transfer successful results once from stock
readyandspawnoperations instead of cloning them under the state lock. This removes the nativeAddRefreentry deadlock and lets both factories acceptSend-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.