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

Make EventLoopFuture/Promise conditionally Sendable #2113

Closed

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented May 13, 2022

and .get() only available if Value is Sendable:

extension EventLoopPromise: Sendable where Value: Sendable { }
extension EventLoopFuture: Sendable where Value: Sendable { }
extension EventLoopFuture where Value: Sendable {
    func get() async throws { ... }
}

Also fix warnings because of these changes.

Normally this is a source-breaking change. However, Sendable is special and it looks like it may be a API stable change.

@@ -98,7 +98,7 @@ extension Channel {
/// Get the value of `option` for this `Channel`.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@inlinable
public func getOption<Option: ChannelOption>(_ option: Option) async throws -> Option.Value {
public func getOption<Option: ChannelOption>(_ option: Option) async throws -> Option.Value where Option.Value: Sendable {
Copy link
Member Author

Choose a reason for hiding this comment

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

ChannelOption.Value should be Sendable but currently we can't do so in source stable way #2108


#if swift(>=5.5) && canImport(_Concurrency)
@usableFromInline
internal struct UncheckedSendable<Value>: @unchecked Sendable {
Copy link
Member Author

Choose a reason for hiding this comment

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

only used in deprecated methods to silence warnings

and `.get()` only available if `Value` is `Sendable`.
Also fix warnings because of that change.
@dnadoba dnadoba force-pushed the dn-sendable-future-promise-conditionally branch from 71522d1 to 8aa859e Compare May 13, 2022 16:26
@Lukasa
Copy link
Contributor

Lukasa commented Jan 14, 2025

These are now unilaterally Sendable.

@Lukasa Lukasa closed this Jan 14, 2025
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