Skip to content

Commit

Permalink
Add some trivial Sendable annotations (#3060)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Lukasa authored Jan 15, 2025
1 parent 6ac01d1 commit ba72f31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/NIOCore/ChannelOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/// `SocketOption` allows users to specify configuration settings that are directly applied to the underlying socket file descriptor.
///
Expand Down
6 changes: 3 additions & 3 deletions Sources/NIOPosix/BSDSocketAPICommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protocol _SocketShutdownProtocol {
}

@usableFromInline
internal enum Shutdown: _SocketShutdownProtocol {
internal enum Shutdown: _SocketShutdownProtocol, Sendable {
case RD
case WR
case RDWR
Expand All @@ -49,7 +49,7 @@ extension NIOBSDSocket {
extension NIOBSDSocket {
/// Specifies the type of socket.
@usableFromInline
internal struct SocketType: RawRepresentable {
internal struct SocketType: RawRepresentable, Sendable {
public typealias RawValue = CInt
public var rawValue: RawValue
public init(rawValue: RawValue) {
Expand Down Expand Up @@ -144,7 +144,7 @@ extension NIOBSDSocket {
/// They aren't necessarily protocols in their own right: for example, ``mptcp``
/// is not. They act to modify the socket type instead: thus, ``mptcp`` acts
/// to modify `SOCK_STREAM` to ask for ``mptcp`` support.
public struct ProtocolSubtype: RawRepresentable, Hashable {
public struct ProtocolSubtype: RawRepresentable, Hashable, Sendable {
public typealias RawValue = CInt

/// The underlying value of the protocol subtype.
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOPosix/IntegerTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

@inlinable
Expand Down Expand Up @@ -65,7 +65,7 @@ extension _UInt24: CustomStringConvertible {
// MARK: _UInt56

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

@inlinable init(_ value: UInt64) {
Expand Down

0 comments on commit ba72f31

Please sign in to comment.