Skip to content

Commit cf46c0d

Browse files
committed
Add Sendable conformance to FileDescriptor
1 parent ea39022 commit cf46c0d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Sources/System/FileDescriptor.swift

Lines changed: 5 additions & 4 deletions
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-
// The decision on whether to make FileDescriptor Sendable or not
479-
// is currently being discussed in https://github.com/apple/swift-system/pull/112
480-
//@available(*, unavailable, message: "File descriptors are not completely thread-safe.")
481-
//extension FileDescriptor: Sendable {}
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.
482+
extension FileDescriptor: Sendable {}
482483

483484
extension FileDescriptor.AccessMode: Sendable {}
484485
extension FileDescriptor.OpenOptions: Sendable {}

0 commit comments

Comments
 (0)