Skip to content

Commit ba72f31

Browse files
authored
Add some trivial Sendable annotations (#3060)
Motivation We have a few types lying around that can trivially be Sendable, and that `-require-explicit-sendable` needs to be `Sendable`. Let's add those annotations. Modifications Made a few types Sendable Result One step closer to our strict concurrency goal
1 parent 6ac01d1 commit ba72f31

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/NIOCore/ChannelOption.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public typealias ConnectTimeoutOption = ChannelOptions.Types.ConnectTimeoutOptio
6464
public typealias AllowRemoteHalfClosureOption = ChannelOptions.Types.AllowRemoteHalfClosureOption
6565

6666
extension ChannelOptions {
67-
public enum Types {
67+
public enum Types: Sendable {
6868

6969
/// `SocketOption` allows users to specify configuration settings that are directly applied to the underlying socket file descriptor.
7070
///

Sources/NIOPosix/BSDSocketAPICommon.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protocol _SocketShutdownProtocol {
3232
}
3333

3434
@usableFromInline
35-
internal enum Shutdown: _SocketShutdownProtocol {
35+
internal enum Shutdown: _SocketShutdownProtocol, Sendable {
3636
case RD
3737
case WR
3838
case RDWR
@@ -49,7 +49,7 @@ extension NIOBSDSocket {
4949
extension NIOBSDSocket {
5050
/// Specifies the type of socket.
5151
@usableFromInline
52-
internal struct SocketType: RawRepresentable {
52+
internal struct SocketType: RawRepresentable, Sendable {
5353
public typealias RawValue = CInt
5454
public var rawValue: RawValue
5555
public init(rawValue: RawValue) {
@@ -144,7 +144,7 @@ extension NIOBSDSocket {
144144
/// They aren't necessarily protocols in their own right: for example, ``mptcp``
145145
/// is not. They act to modify the socket type instead: thus, ``mptcp`` acts
146146
/// to modify `SOCK_STREAM` to ask for ``mptcp`` support.
147-
public struct ProtocolSubtype: RawRepresentable, Hashable {
147+
public struct ProtocolSubtype: RawRepresentable, Hashable, Sendable {
148148
public typealias RawValue = CInt
149149

150150
/// The underlying value of the protocol subtype.

Sources/NIOPosix/IntegerTypes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/// A 24-bit unsigned integer value type.
1818
@usableFromInline
19-
struct _UInt24 {
19+
struct _UInt24: Sendable {
2020
@usableFromInline var _backing: (UInt16, UInt8)
2121

2222
@inlinable
@@ -65,7 +65,7 @@ extension _UInt24: CustomStringConvertible {
6565
// MARK: _UInt56
6666

6767
/// A 56-bit unsigned integer value type.
68-
struct _UInt56 {
68+
struct _UInt56: Sendable {
6969
@usableFromInline var _backing: (UInt32, UInt16, UInt8)
7070

7171
@inlinable init(_ value: UInt64) {

0 commit comments

Comments
 (0)