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 Sep 23, 2024
1 parent d581098 commit 621c44d
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 @@ -474,8 +479,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 621c44d

Please sign in to comment.