Skip to content

Commit 6e045d7

Browse files
committed
Mark FileDescriptor Sendable conformance as unavailable
1 parent cf46c0d commit 6e045d7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Sources/System/FileDescriptor.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,11 @@ extension FileDescriptor.OpenOptions
475475
}
476476

477477
#if compiler(>=5.5) && canImport(_Concurrency)
478-
// File descriptors aren't necessarily safe to use across threads.
479-
// However, since they can be used in a safe way,
480-
// we do make them `Sendable` to not make it unnecessarily complicated to
481-
// use them across concurrency boundaries in a safe way.
478+
// Since some file descriptor operations aren't safe to use across threads,
479+
// we mark the Sendable conformance as unavailble.
480+
// To use file descriptors with operations that *are* thread-safe,
481+
// wrap them in an `@unchecked Sendable` type.
482+
@available(*, unavailable, message: "File descriptors are not completely thread-safe.")
482483
extension FileDescriptor: Sendable {}
483484

484485
extension FileDescriptor.AccessMode: Sendable {}

0 commit comments

Comments
 (0)