From ac695eb00f94127dbe201c55dd0e5e53bc283963 Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Tue, 8 Aug 2023 11:57:25 +0100 Subject: [PATCH] EventLoopFuture/Promise: only Sendable if Value is Sendable (#2496) Co-authored-by: Cory Benfield --- Sources/NIOCore/EventLoopFuture.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/NIOCore/EventLoopFuture.swift b/Sources/NIOCore/EventLoopFuture.swift index 39f6f35cb..6c79a08ef 100644 --- a/Sources/NIOCore/EventLoopFuture.swift +++ b/Sources/NIOCore/EventLoopFuture.swift @@ -2293,13 +2293,13 @@ public struct _NIOEventLoopFutureIdentifier: Hashable, Sendable { } } -// EventLoopPromise is a reference type, but by its very nature is Sendable. -extension EventLoopPromise: Sendable { } +// EventLoopPromise is a reference type, but by its very nature is Sendable (if its Value is). +extension EventLoopPromise: Sendable where Value: Sendable { } -// EventLoopFuture is a reference type, but it is Sendable. However, we enforce +// EventLoopFuture is a reference type, but it is Sendable (if its Value is). However, we enforce // that by way of the guarantees of the EventLoop protocol, so the compiler cannot // check it. -extension EventLoopFuture: @unchecked Sendable { } +extension EventLoopFuture: @unchecked Sendable where Value: Sendable { } extension EventLoopPromise where Value == Void { // Deliver a successful result to the associated `EventLoopFuture` object.