Repository navigation
Make the wrappers around agile COM objects Send and Sync - #103
Merged
Merged
Conversation
All wrappers except Device and DeviceCollection hold objects that implement IAgileObject or marshal with the free-threaded marshaler, so they can be used from any thread. Device and DeviceCollection stay !Send, since IMMDevice and IMMDeviceCollection are neither agile nor marshalable. - The safety contracts of Device::from_raw and AudioClient::from_raw require the object, and everything it hands out, to be agile. - New device tests check that the objects are agile, and that IMMDevice is not. - A compile time check in public_api.rs for Send and Sync. - Device::as_raw no longer says that the interfaces activated from the device are tied to its apartment, which they are not.
Send and Sync
Owner
Author
|
@LastExceed does this look alright to you? |
LastExceed
suggested changes
Dec 1, 2026
LastExceed
left a comment
Contributor
There was a problem hiding this comment.
First (and probably last) code review done entirely on phone😬
…-sync # Conflicts: # tests/device/bindings.rs # tests/public_api.rs
- agility() returns an Agility enum instead of a string - assert_agile no longer prints, the output was never shown - Explain that device_is_not_agile is the negative control - "in the apartment" rather than "on the apartment"
LastExceed
suggested changes
Dec 2, 2026
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.
Closes #95.
Send + Syncfor every wrapper exceptDeviceandDeviceCollection, which stay!SendDevice::from_rawandAudioClient::from_rawrequire the object, and everything it hands out, to be agileIAgileObjector the free-threaded marshaler), and thatIMMDeviceis notSendandSyncintests/public_api.rs