From 2faca73d3511ba11106f19db69be7e21e4c82d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klemen=20=C4=8Cede?= Date: Thu, 16 Oct 2025 19:40:21 +0200 Subject: [PATCH] Add missing Sendable conformances --- src/swift/Block.swift | 2 +- src/swift/Data.swift | 8 ++++---- src/swift/IO.swift | 6 +++--- src/swift/Queue.swift | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/swift/Block.swift b/src/swift/Block.swift index 6459ba786..ae6a05ffd 100644 --- a/src/swift/Block.swift +++ b/src/swift/Block.swift @@ -13,7 +13,7 @@ import CDispatch @_implementationOnly import _DispatchOverlayShims -public struct DispatchWorkItemFlags : OptionSet, RawRepresentable { +public struct DispatchWorkItemFlags : OptionSet, RawRepresentable, Sendable { public let rawValue: UInt public init(rawValue: UInt) { self.rawValue = rawValue } diff --git a/src/swift/Data.swift b/src/swift/Data.swift index ac962d71c..98192c0bf 100644 --- a/src/swift/Data.swift +++ b/src/swift/Data.swift @@ -13,14 +13,14 @@ import CDispatch @_implementationOnly import _DispatchOverlayShims -public struct DispatchData : RandomAccessCollection { +public struct DispatchData : RandomAccessCollection, Sendable { public typealias Iterator = DispatchDataIterator public typealias Index = Int public typealias Indices = DefaultIndices public static let empty: DispatchData = DispatchData(data: _swift_dispatch_data_empty()) - public enum Deallocator { + public enum Deallocator : Sendable { /// Use `free` case free @@ -34,7 +34,7 @@ public struct DispatchData : RandomAccessCollection { // However, adding the annotation here results in Data.o containing // a reference to _TMBO (opaque metadata for Builtin.UnknownObject) // which is only made available on platforms with Objective-C. - case custom(DispatchQueue?, () -> Void) + @preconcurrency case custom(DispatchQueue?, () -> Void) fileprivate var _deallocator: (DispatchQueue?, @convention(block) () -> Void) { switch self { @@ -329,7 +329,7 @@ public struct DispatchData : RandomAccessCollection { } } -public struct DispatchDataIterator : IteratorProtocol, Sequence { +public struct DispatchDataIterator : IteratorProtocol, Sequence, @unchecked Sendable { public typealias Element = UInt8 /// Create an iterator over the given DispatchData diff --git a/src/swift/IO.swift b/src/swift/IO.swift index 3c0e22484..6eda7cb90 100644 --- a/src/swift/IO.swift +++ b/src/swift/IO.swift @@ -17,19 +17,19 @@ import WinSDK extension DispatchIO { - public enum StreamType : UInt { + public enum StreamType : UInt, Sendable { case stream = 0 case random = 1 } - public struct CloseFlags : OptionSet, RawRepresentable { + public struct CloseFlags : OptionSet, RawRepresentable, Sendable { public let rawValue: UInt public init(rawValue: UInt) { self.rawValue = rawValue } public static let stop = CloseFlags(rawValue: 1) } - public struct IntervalFlags : OptionSet, RawRepresentable { + public struct IntervalFlags : OptionSet, RawRepresentable, Sendable { public let rawValue: UInt public init(rawValue: UInt) { self.rawValue = rawValue } public init(nilLiteral: ()) { self.rawValue = 0 } diff --git a/src/swift/Queue.swift b/src/swift/Queue.swift index f590c32df..9a6ea0792 100644 --- a/src/swift/Queue.swift +++ b/src/swift/Queue.swift @@ -28,7 +28,7 @@ internal class _DispatchSpecificValue { } extension DispatchQueue { - public struct Attributes : OptionSet { + public struct Attributes : OptionSet, Sendable { public let rawValue: UInt64 public init(rawValue: UInt64) { self.rawValue = rawValue } @@ -52,7 +52,7 @@ extension DispatchQueue { } } - public enum GlobalQueuePriority { + public enum GlobalQueuePriority : Sendable { @available(macOS, deprecated: 10.10, message: "Use qos attributes instead") @available(iOS, deprecated: 8.0, message: "Use qos attributes instead") @available(tvOS, deprecated, message: "Use qos attributes instead") @@ -87,7 +87,7 @@ extension DispatchQueue { } } - public enum AutoreleaseFrequency { + public enum AutoreleaseFrequency : Sendable { case inherit @available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)