Skip to content

Commit

Permalink
Add Sendable conformance to FileDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Oct 10, 2023
1 parent 0e060b7 commit 9a8527f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/System/FileDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
/// You are responsible for managing the lifetime and validity
/// of `FileDescriptor` values,
/// in the same way as you manage a raw C file handle.
///
/// File descriptors are not necessarily safe to use across threads,
/// even though they conform to `Sendable`.
/// It is your responsibility to make sure that
/// they are not used in an insecure way.
@frozen
@available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *)
public struct FileDescriptor: RawRepresentable, Hashable, Codable {
public struct FileDescriptor: RawRepresentable, Sendable, Hashable, Codable {
/// The raw C file handle.
@_alwaysEmitIntoClient
public let rawValue: CInt
Expand Down Expand Up @@ -477,8 +482,3 @@ extension FileDescriptor.OpenOptions
/// A textual representation of the open options, suitable for debugging.
public var debugDescription: String { self.description }
}

// The decision on whether to make FileDescriptor Sendable or not
// is currently being discussed in https://github.com/apple/swift-system/pull/112
//@available(*, unavailable, message: "File descriptors are not completely thread-safe.")
//extension FileDescriptor: Sendable {}

0 comments on commit 9a8527f

Please sign in to comment.