EventLoopFuture/Promise: only Sendable if Value is Sendable (#2496)

Co-authored-by: Cory Benfield <lukasa@apple.com>
This commit is contained in:
Johannes WeissandCory Benfield authored and GitHub committed 2023-08-08 03:57:25 -07:00
1 parent cf281631ff
commit ac695eb00f
1 file changed
+4 -4
+4 -4
View File
@@ -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<Void>` object.