Skip to content

Commit 621c44d

Browse files
committed
Add Sendable conformance to FileDescriptor
1 parent d581098 commit 621c44d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/System/FileDescriptor.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@
1313
/// You are responsible for managing the lifetime and validity
1414
/// of `FileDescriptor` values,
1515
/// 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.
1621
@frozen
1722
@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 {
1924
/// The raw C file handle.
2025
@_alwaysEmitIntoClient
2126
public let rawValue: CInt
@@ -474,8 +479,3 @@ extension FileDescriptor.OpenOptions
474479
/// A textual representation of the open options, suitable for debugging.
475480
public var debugDescription: String { self.description }
476481
}
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

Comments
 (0)