@@ -53,7 +53,10 @@ import Swift
53
53
///
54
54
/// // child tasks execute on 'specific' task executor:
55
55
/// async let x = ...
56
- /// await withTaskGroup(of: Int.self) { group in g.addTask { 7 } }
56
+ /// await withTaskGroup(of: Int.self) { group in
57
+ /// group.addTask { 7 } // child task executes on 'specific' executor
58
+ /// group.addTask(on: .default) { 13 } // child task executes on default executor
59
+ /// }
57
60
///
58
61
/// // disable the task executor preference:
59
62
/// await withTaskExecutor(.default) {
@@ -81,7 +84,7 @@ import Swift
81
84
@available ( SwiftStdlib 9999 , * )
82
85
@_unsafeInheritExecutor // calling withTaskExecutor MUST NOT perform the "usual" hop to global
83
86
public func _withTaskExecutor< T: Sendable > (
84
- _ taskExecutorPreference: any _TaskExecutor ,
87
+ _ taskExecutorPreference: some _TaskExecutor ,
85
88
operation: @Sendable ( ) async throws -> T
86
89
) async rethrows -> T {
87
90
let taskExecutorBuiltin : Builtin . Executor =
@@ -173,7 +176,7 @@ extension Task where Failure == Never {
173
176
@discardableResult
174
177
@_alwaysEmitIntoClient
175
178
public init (
176
- _on executor: any _TaskExecutor ,
179
+ _on executor: some _TaskExecutor ,
177
180
priority: TaskPriority ? = nil ,
178
181
operation: __owned @Sendable @escaping ( ) async -> Success
179
182
) {
@@ -201,7 +204,7 @@ extension Task where Failure == Error {
201
204
@discardableResult
202
205
@_alwaysEmitIntoClient
203
206
public init (
204
- _on executor: any _TaskExecutor ,
207
+ _on executor: some _TaskExecutor ,
205
208
priority: TaskPriority ? = nil ,
206
209
operation: __owned @Sendable @escaping ( ) async throws -> Success
207
210
) {
@@ -233,7 +236,7 @@ extension Task where Failure == Never {
233
236
@_alwaysEmitIntoClient
234
237
@available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
235
238
public static func _detached(
236
- on executor: any _TaskExecutor ,
239
+ on executor: some _TaskExecutor ,
237
240
priority: TaskPriority ? = nil ,
238
241
operation: __owned @Sendable @escaping ( ) async -> Success
239
242
) -> Task < Success , Failure > {
@@ -264,7 +267,7 @@ extension Task where Failure == Never {
264
267
@discardableResult
265
268
@_alwaysEmitIntoClient
266
269
public static func _detached(
267
- on executor: any _TaskExecutor ,
270
+ on executor: some _TaskExecutor ,
268
271
priority: TaskPriority ? = nil ,
269
272
operation: __owned @Sendable @escaping ( ) async -> Success
270
273
) -> Task < Success , Failure > {
@@ -296,7 +299,7 @@ extension Task where Failure == Error {
296
299
@_alwaysEmitIntoClient
297
300
@available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
298
301
public static func _detached(
299
- on executor: any _TaskExecutor ,
302
+ on executor: some _TaskExecutor ,
300
303
priority: TaskPriority ? = nil ,
301
304
operation: __owned @Sendable @escaping ( ) async throws -> Success
302
305
) -> Task < Success , Failure > {
@@ -329,7 +332,7 @@ extension Task where Failure == Error {
329
332
@discardableResult
330
333
@_alwaysEmitIntoClient
331
334
public static func _detached(
332
- on executor: any _TaskExecutor ,
335
+ on executor: some _TaskExecutor ,
333
336
priority: TaskPriority ? = nil ,
334
337
operation: __owned @Sendable @escaping ( ) async throws -> Success
335
338
) -> Task < Success , Failure > {
0 commit comments