Skip to content

Commit ea39022

Browse files
committed
Add Sendable conformances
1 parent 18cceda commit ea39022

File tree

6 files changed

+34
-0
lines changed

6 files changed

+34
-0
lines changed

Sources/System/FileDescriptor.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,3 +473,14 @@ extension FileDescriptor.OpenOptions
473473
/// A textual representation of the open options, suitable for debugging.
474474
public var debugDescription: String { self.description }
475475
}
476+
477+
#if compiler(>=5.5) && canImport(_Concurrency)
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 {}
482+
483+
extension FileDescriptor.AccessMode: Sendable {}
484+
extension FileDescriptor.OpenOptions: Sendable {}
485+
extension FileDescriptor.SeekOrigin: Sendable {}
486+
#endif

Sources/System/FilePath/FilePath.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@ extension FilePath {
6969
/*System 0.0.1, @available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)*/
7070
extension FilePath: Hashable, Codable {}
7171

72+
#if compiler(>=5.5) && canImport(_Concurrency)
73+
extension FilePath: Sendable {}
74+
#endif

Sources/System/FilePath/FilePathComponentView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,8 @@ extension FilePath.ComponentView {
238238
#endif // DEBUG
239239
}
240240
}
241+
242+
#if compiler(>=5.5) && canImport(_Concurrency)
243+
extension FilePath.ComponentView: Sendable {}
244+
extension FilePath.ComponentView.Index: Sendable {}
245+
#endif

Sources/System/FilePath/FilePathComponents.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,9 @@ extension FilePath.Root {
276276
#endif
277277
}
278278
}
279+
280+
#if compiler(>=5.5) && canImport(_Concurrency)
281+
extension FilePath.Root: Sendable {}
282+
extension FilePath.Component: Sendable {}
283+
extension FilePath.Component.Kind: Sendable {}
284+
#endif

Sources/System/FilePermissions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,7 @@ extension FilePermissions
175175
/// A textual representation of the file permissions, suitable for debugging.
176176
public var debugDescription: String { self.description }
177177
}
178+
179+
#if compiler(>=5.5) && canImport(_Concurrency)
180+
extension FilePermissions: Sendable {}
181+
#endif

Sources/System/SystemString.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ extension SystemString {
288288
}
289289
}
290290

291+
#if compiler(>=5.5) && canImport(_Concurrency)
292+
extension SystemChar: Sendable {}
293+
extension SystemString: Sendable {}
294+
#endif
295+
291296
// TODO: SystemString should use a COW-interchangable storage form rather
292297
// than array, so you could "borrow" the storage from a non-bridged String
293298
// or Data or whatever

0 commit comments

Comments
 (0)