-
Notifications
You must be signed in to change notification settings - Fork 651
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 explicit Sendable
unavailability and add missing Sendable
conformances
#2578
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ let SO_TIMESTAMP = CNIOLinux_SO_TIMESTAMP | |
let SO_RCVTIMEO = CNIOLinux_SO_RCVTIMEO | ||
#endif | ||
|
||
public enum NIOBSDSocket { | ||
public enum NIOBSDSocket: Sendable{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we can make a socket There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a namespace. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good catch. Then my comments from below apply. Should we really make namespaces There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't see any reason to do so. |
||
#if os(Windows) | ||
public typealias Handle = SOCKET | ||
#else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -378,7 +378,7 @@ extension ChannelError: Equatable { } | |
/// The removal of a `ChannelHandler` using `ChannelPipeline.removeHandler` has been attempted more than once. | ||
public struct NIOAttemptedToRemoveHandlerMultipleTimesError: Error {} | ||
|
||
public enum DatagramChannelError { | ||
public enum DatagramChannelError: Sendable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a namespace right? We probably shouldn't make it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I will mark it then as non-sendable. I don't think it really matters though. |
||
public struct WriteOnUnconnectedSocketWithoutAddress: Error { | ||
public init() {} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ public typealias ConnectTimeoutOption = ChannelOptions.Types.ConnectTimeoutOptio | |
public typealias AllowRemoteHalfClosureOption = ChannelOptions.Types.AllowRemoteHalfClosureOption | ||
|
||
extension ChannelOptions { | ||
public enum Types { | ||
public enum Types: Sendable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. This is just a namespace right? |
||
|
||
/// `SocketOption` allows users to specify configuration settings that are directly applied to the underlying socket file descriptor. | ||
/// | ||
|
@@ -291,7 +291,7 @@ extension ChannelOptions { | |
} | ||
|
||
/// Provides `ChannelOption`s to be used with a `Channel`, `Bootstrap` or `ServerBootstrap`. | ||
public struct ChannelOptions { | ||
public struct ChannelOptions: Sendable { | ||
#if !os(Windows) | ||
public static let socket = { (level: SocketOptionLevel, name: SocketOptionName) -> Types.SocketOption in | ||
.init(level: NIOBSDSocket.OptionLevel(rawValue: CInt(level)), name: NIOBSDSocket.Option(rawValue: CInt(name))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure about that one the
Sink
is notSendable
right now because we expect it to be only held in one isolation domain at any given time even though it is fully thread-safe. We certainly can't make this typeunchecked Sendable
then. So we either make theSink
Sendable
as well or don't make this oneSendable