Skip to content

Commit

Permalink
Merge pull request #821 from ktoso/wip-sendable
Browse files Browse the repository at this point in the history
  • Loading branch information
ktoso authored Mar 29, 2024
2 parents 1897407 + 2df0f76 commit 7776634
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/swift/Queue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ extension DispatchQueue {
group: DispatchGroup? = nil,
qos: DispatchQoS = .unspecified,
flags: DispatchWorkItemFlags = [],
execute work: @escaping @convention(block) () -> Void)
execute work: @escaping @Sendable @convention(block) () -> Void)
{
if group == nil && qos == .unspecified {
// Fast-path route for the most common API usage
Expand Down Expand Up @@ -387,7 +387,7 @@ extension DispatchQueue {
deadline: DispatchTime,
qos: DispatchQoS = .unspecified,
flags: DispatchWorkItemFlags = [],
execute work: @escaping @convention(block) () -> Void)
execute work: @escaping @Sendable @convention(block) () -> Void)
{
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
Expand Down Expand Up @@ -418,7 +418,7 @@ extension DispatchQueue {
wallDeadline: DispatchWallTime,
qos: DispatchQoS = .unspecified,
flags: DispatchWorkItemFlags = [],
execute work: @escaping @convention(block) () -> Void)
execute work: @escaping @Sendable @convention(block) () -> Void)
{
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
Expand Down
11 changes: 6 additions & 5 deletions src/swift/Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class DispatchObject {
}


public class DispatchGroup : DispatchObject {
public class DispatchGroup : DispatchObject, @unchecked Sendable {
internal let __wrapped:dispatch_group_t;

final internal override func wrapped() -> dispatch_object_t {
Expand All @@ -68,7 +68,7 @@ public class DispatchGroup : DispatchObject {
}
}

public class DispatchSemaphore : DispatchObject {
public class DispatchSemaphore : DispatchObject, @unchecked Sendable {
internal let __wrapped: dispatch_semaphore_t;

final internal override func wrapped() -> dispatch_object_t {
Expand All @@ -84,8 +84,8 @@ public class DispatchSemaphore : DispatchObject {
}
}

public class DispatchIO : DispatchObject {
internal let __wrapped:dispatch_io_t
public class DispatchIO : DispatchObject, @unchecked Sendable {
internal let __wrapped: dispatch_io_t

final internal override func wrapped() -> dispatch_object_t {
return unsafeBitCast(__wrapped, to: dispatch_object_t.self)
Expand Down Expand Up @@ -127,7 +127,7 @@ public class DispatchIO : DispatchObject {
}
}

public class DispatchQueue : DispatchObject {
public class DispatchQueue : DispatchObject, @unchecked Sendable {
internal let __wrapped:dispatch_queue_t;

final internal override func wrapped() -> dispatch_object_t {
Expand Down Expand Up @@ -156,6 +156,7 @@ public class DispatchQueue : DispatchObject {
}

public class DispatchSource : DispatchObject,
@unchecked Sendable,
DispatchSourceProtocol, DispatchSourceRead,
DispatchSourceSignal, DispatchSourceTimer,
DispatchSourceUserDataAdd, DispatchSourceUserDataOr,
Expand Down

0 comments on commit 7776634

Please sign in to comment.