From 29ebbaabe744881d7789b94ff565b6e9955829e1 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 21 Apr 2023 12:30:38 +0100 Subject: [PATCH 1/2] Mark `DispatchTimeInterval` as `Sendable` This is an `enum` with associated values of `Int` type that are all `Sendable`, so should be safe mark the whole `enum` as such. Resolves https://github.com/apple/swift-corelibs-libdispatch/issues/787. --- src/swift/Time.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swift/Time.swift b/src/swift/Time.swift index e1f2efc7d..f426bb319 100644 --- a/src/swift/Time.swift +++ b/src/swift/Time.swift @@ -165,7 +165,7 @@ private func toInt64Clamped(_ value: Double) -> Int64 { /// let t1 = DispatchTimeInterval.seconds(Int.max) /// let t2 = DispatchTimeInterval.milliseconds(Int.max) /// let result = t1 == t2 // true -public enum DispatchTimeInterval: Equatable { +public enum DispatchTimeInterval: Equatable, Sendable { case seconds(Int) case milliseconds(Int) case microseconds(Int) From 7c19a4fe839e224030acaf51d655b20202563767 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Tue, 25 Apr 2023 07:50:08 +0900 Subject: [PATCH 2/2] DispatchWallTime and Time are also sendable --- src/swift/Time.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swift/Time.swift b/src/swift/Time.swift index f426bb319..bc93d5e72 100644 --- a/src/swift/Time.swift +++ b/src/swift/Time.swift @@ -16,7 +16,7 @@ import CDispatch -public struct DispatchTime : Comparable { +public struct DispatchTime : Comparable, Sendable { #if HAVE_MACH private static let timebaseInfo: mach_timebase_info_data_t = { var info = mach_timebase_info_data_t(numer: 1, denom: 1) @@ -96,7 +96,7 @@ extension DispatchTime { } } -public struct DispatchWallTime : Comparable { +public struct DispatchWallTime : Comparable, Sendable { public let rawValue: dispatch_time_t public static func now() -> DispatchWallTime {