From 6d30ec4738389e875f1a22345463468d4d581063 Mon Sep 17 00:00:00 2001 From: George Barnett Date: Thu, 7 Nov 2024 14:52:06 +0000 Subject: [PATCH] Remove sendable checking from NIOLock and NIOLockedValueBox (#2968) 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 --- Sources/NIOConcurrencyHelpers/NIOLock.swift | 4 +--- Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/NIOConcurrencyHelpers/NIOLock.swift b/Sources/NIOConcurrencyHelpers/NIOLock.swift index 25b0d1b612..af3818aef3 100644 --- a/Sources/NIOConcurrencyHelpers/NIOLock.swift +++ b/Sources/NIOConcurrencyHelpers/NIOLock.swift @@ -185,8 +185,6 @@ final class LockStorage: ManagedBuffer { } } -extension LockStorage: @unchecked Sendable {} - /// A threading lock based on `libpthread` instead of `libdispatch`. /// /// - Note: ``NIOLock`` has reference semantics. @@ -253,7 +251,7 @@ extension NIOLock { } } -extension NIOLock: Sendable {} +extension NIOLock: @unchecked Sendable {} extension UnsafeMutablePointer { @inlinable diff --git a/Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift b/Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift index f13a9d9e6b..407588a75e 100644 --- a/Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift +++ b/Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift @@ -79,4 +79,4 @@ public struct NIOLockedValueBox { } } -extension NIOLockedValueBox: Sendable where Value: Sendable {} +extension NIOLockedValueBox: @unchecked Sendable where Value: Sendable {}