Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sendable annotations to new async APIs #427

Closed
wants to merge 1 commit into from

Conversation

FranzBusch
Copy link
Member

Motivation

We just released our new async APIs but forgot to mark the new types as Sendable. This is causing warnings for users and we should properly mark them as Sendable since we expect users to use them from concurrent contexts.

Modification

Adding Sendable to the NIONegotiatedHTTPVersion was pretty straight forward; however, adding Sendable to AsyncStreamMultiplexer was a bit more complicated since it stored the InlineStreamMultiplexer which we cannot easily make Sendable. Hence, we are now holding the InlineStreamMultiplexer in a NIOLoopBound and are submitting the work to the correct EventLoop before we call the underlying multiplexer.

Result

No more Sendable warnings for our users.

# Motivation
We just released our new async APIs but forgot to mark the new types as `Sendable`. This is causing warnings for users and we should properly mark them as `Sendable` since we expect users to use them from concurrent contexts.

# Modification
Adding `Sendable` to the `NIONegotiatedHTTPVersion` was pretty straight forward; however, adding `Sendable` to `AsyncStreamMultiplexer` was a bit more complicated since it stored the `InlineStreamMultiplexer` which we cannot easily make `Sendable`. Hence, we are now holding the `InlineStreamMultiplexer` in a `NIOLoopBound` and are submitting the work to the correct `EventLoop` before we call the underlying multiplexer.

# Result
No more `Sendable` warnings for our users.
@FranzBusch FranzBusch requested review from glbrntt and Lukasa October 27, 2023 08:16
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Oct 27, 2023
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

@rnro has been working on changes in this area in #417. I talked him out of using NIOLoopBound for the use-case you used it, and I'd like to do the same here. Please align with those changes.

@FranzBusch
Copy link
Member Author

Let's close this in favour of @rnro PR then and work on the lense type a bit more.

@FranzBusch FranzBusch closed this Oct 27, 2023
@FranzBusch FranzBusch deleted the fb-sendable-async-apis branch October 27, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants