Skip to content

Commit

Permalink
Remove sendable checking from NIOLock and NIOLockedValueBox (#2968)
Browse files Browse the repository at this point in the history
Motivation:

ManagedBuffer is marked as explicitly not sendable on Swift nightly
builds. NIOLock and NIOLockedValueBox used a type derived from
ManagedBuffer and must be Sendable. Currently the derived type is marked
as `@unchecked Sendable`. However on nightly toolchains this now
conflicts with being explicitly not Sendable.

Modifications:

- Remove Sendable checking on NIOLock and NIOLockedValueBox

Result:

Fewer warnings

(cherry picked from commit 6d30ec4)
  • Loading branch information
glbrntt authored and Lukasa committed Nov 22, 2024
1 parent 653da4d commit 2cb88a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Sources/NIOConcurrencyHelpers/NIOLock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ final class LockStorage<Value>: ManagedBuffer<Value, LockPrimitive> {
}
}

extension LockStorage: @unchecked Sendable {}

/// A threading lock based on `libpthread` instead of `libdispatch`.
///
/// - Note: ``NIOLock`` has reference semantics.
Expand Down Expand Up @@ -253,7 +251,7 @@ extension NIOLock {
}
}

extension NIOLock: Sendable {}
extension NIOLock: @unchecked Sendable {}

extension UnsafeMutablePointer {
@inlinable
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ public struct NIOLockedValueBox<Value> {
}
}

extension NIOLockedValueBox: Sendable where Value: Sendable {}
extension NIOLockedValueBox: @unchecked Sendable where Value: Sendable {}

0 comments on commit 2cb88a4

Please sign in to comment.