|
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
|
@@ -474,8 +479,3 @@ extension FileDescriptor.OpenOptions
|
474 | 479 | /// A textual representation of the open options, suitable for debugging.
|
475 | 480 | public var debugDescription: String { self.description }
|
476 | 481 | }
|
477 |
| - |
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 {} |
0 commit comments