Skip to content

Commit dd086a0

Browse files
committed
Add Sendable conformance to FileDescriptor
1 parent 0062c82 commit dd086a0

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
@@ -476,10 +476,11 @@ extension FileDescriptor.OpenOptions
476476
}
477477

478478
#if compiler(>=5.5) && canImport(_Concurrency)
479-
// The decision on whether to make FileDescriptor Sendable or not
480-
// is currently being discussed in https://github.com/apple/swift-system/pull/112
481-
//@available(*, unavailable, message: "File descriptors are not completely thread-safe.")
482-
//extension FileDescriptor: Sendable {}
479+
// File descriptors aren't necessarily safe to use across threads.
480+
// However, since they can be used in a safe way,
481+
// we do make them `Sendable` to not make it unnecessarily complicated to
482+
// use them across concurrency boundaries in a safe way.
483+
extension FileDescriptor: Sendable {}
483484

484485
@available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *)
485486
extension FileDescriptor.AccessMode: Sendable {}

0 commit comments

Comments
 (0)