Skip to content

Commit 7776634

Browse files
authored
Merge pull request #821 from ktoso/wip-sendable
2 parents 1897407 + 2df0f76 commit 7776634

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/swift/Queue.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ extension DispatchQueue {
253253
group: DispatchGroup? = nil,
254254
qos: DispatchQoS = .unspecified,
255255
flags: DispatchWorkItemFlags = [],
256-
execute work: @escaping @convention(block) () -> Void)
256+
execute work: @escaping @Sendable @convention(block) () -> Void)
257257
{
258258
if group == nil && qos == .unspecified {
259259
// Fast-path route for the most common API usage
@@ -387,7 +387,7 @@ extension DispatchQueue {
387387
deadline: DispatchTime,
388388
qos: DispatchQoS = .unspecified,
389389
flags: DispatchWorkItemFlags = [],
390-
execute work: @escaping @convention(block) () -> Void)
390+
execute work: @escaping @Sendable @convention(block) () -> Void)
391391
{
392392
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
393393
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
@@ -418,7 +418,7 @@ extension DispatchQueue {
418418
wallDeadline: DispatchWallTime,
419419
qos: DispatchQoS = .unspecified,
420420
flags: DispatchWorkItemFlags = [],
421-
execute work: @escaping @convention(block) () -> Void)
421+
execute work: @escaping @Sendable @convention(block) () -> Void)
422422
{
423423
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
424424
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)

src/swift/Wrapper.swift

+6-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class DispatchObject {
4444
}
4545

4646

47-
public class DispatchGroup : DispatchObject {
47+
public class DispatchGroup : DispatchObject, @unchecked Sendable {
4848
internal let __wrapped:dispatch_group_t;
4949

5050
final internal override func wrapped() -> dispatch_object_t {
@@ -68,7 +68,7 @@ public class DispatchGroup : DispatchObject {
6868
}
6969
}
7070

71-
public class DispatchSemaphore : DispatchObject {
71+
public class DispatchSemaphore : DispatchObject, @unchecked Sendable {
7272
internal let __wrapped: dispatch_semaphore_t;
7373

7474
final internal override func wrapped() -> dispatch_object_t {
@@ -84,8 +84,8 @@ public class DispatchSemaphore : DispatchObject {
8484
}
8585
}
8686

87-
public class DispatchIO : DispatchObject {
88-
internal let __wrapped:dispatch_io_t
87+
public class DispatchIO : DispatchObject, @unchecked Sendable {
88+
internal let __wrapped: dispatch_io_t
8989

9090
final internal override func wrapped() -> dispatch_object_t {
9191
return unsafeBitCast(__wrapped, to: dispatch_object_t.self)
@@ -127,7 +127,7 @@ public class DispatchIO : DispatchObject {
127127
}
128128
}
129129

130-
public class DispatchQueue : DispatchObject {
130+
public class DispatchQueue : DispatchObject, @unchecked Sendable {
131131
internal let __wrapped:dispatch_queue_t;
132132

133133
final internal override func wrapped() -> dispatch_object_t {
@@ -156,6 +156,7 @@ public class DispatchQueue : DispatchObject {
156156
}
157157

158158
public class DispatchSource : DispatchObject,
159+
@unchecked Sendable,
159160
DispatchSourceProtocol, DispatchSourceRead,
160161
DispatchSourceSignal, DispatchSourceTimer,
161162
DispatchSourceUserDataAdd, DispatchSourceUserDataOr,

0 commit comments

Comments
 (0)