Skip to content

Add missing Sendable conformances to DispatchPredicate, DispatchQoS, and DispatchTimeoutResult. #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/swift/Dispatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import CDispatch
/// dispatch_assert

@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
public enum DispatchPredicate {
public enum DispatchPredicate : Sendable {
case onQueue(DispatchQueue)
case onQueueAsBarrier(DispatchQueue)
case notOnQueue(DispatchQueue)
Expand Down Expand Up @@ -46,7 +46,7 @@ public func dispatchPrecondition(condition: @autoclosure () -> DispatchPredicate

/// qos_class_t

public struct DispatchQoS : Equatable {
public struct DispatchQoS : Equatable, Sendable {
public let qosClass: QoSClass
public let relativePriority: Int

Expand All @@ -67,7 +67,7 @@ public struct DispatchQoS : Equatable {

public static let unspecified = DispatchQoS(qosClass: .unspecified, relativePriority: 0)

public enum QoSClass {
public enum QoSClass : Sendable {
@available(macOS 10.10, iOS 8.0, *)
case background

Expand Down Expand Up @@ -125,7 +125,7 @@ public func ==(a: DispatchQoS, b: DispatchQoS) -> Bool {

///

public enum DispatchTimeoutResult {
public enum DispatchTimeoutResult : Sendable {
static let KERN_OPERATION_TIMED_OUT:Int = 49
case success
case timedOut
Expand Down
3 changes: 3 additions & 0 deletions src/swift/Queue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public final class DispatchSpecificKey<T> {
public init() {}
}

extension DispatchSpecificKey : Sendable where T : Sendable {
}

internal class _DispatchSpecificValue<T> {
internal let value: T
internal init(value: T) { self.value = value }
Expand Down