|
13 | 13 | /// You are responsible for managing the lifetime and validity |
14 | 14 | /// of `FileDescriptor` values, |
15 | 15 | /// in the same way as you manage a raw C file handle. |
| 16 | +/// |
| 17 | +/// File descriptors are not necessarily safe to use across threads, |
| 18 | +/// even though they conform to `Sendable`. |
| 19 | +/// It is your responsibility to make sure that |
| 20 | +/// they are not used in an insecure way. |
16 | 21 | @frozen |
17 | 22 | @available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *) |
18 | | -public struct FileDescriptor: RawRepresentable, Hashable, Codable { |
| 23 | +public struct FileDescriptor: RawRepresentable, Sendable, Hashable, Codable { |
19 | 24 | /// The raw C file handle. |
20 | 25 | @_alwaysEmitIntoClient |
21 | 26 | public let rawValue: CInt |
@@ -477,8 +482,3 @@ extension FileDescriptor.OpenOptions |
477 | 482 | /// A textual representation of the open options, suitable for debugging. |
478 | 483 | public var debugDescription: String { self.description } |
479 | 484 | } |
480 | | - |
481 | | -// The decision on whether to make FileDescriptor Sendable or not |
482 | | -// is currently being discussed in https://github.com/apple/swift-system/pull/112 |
483 | | -//@available(*, unavailable, message: "File descriptors are not completely thread-safe.") |
484 | | -//extension FileDescriptor: Sendable {} |
0 commit comments