@@ -220,6 +220,16 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
220
220
}
221
221
}
222
222
223
+ // Historical entry point, maintained for ABI compatibility
224
+ @usableFromInline
225
+ mutating func spawn(
226
+ priority: Task . Priority ,
227
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
228
+ ) {
229
+ let optPriority : Task . Priority ? = priority
230
+ spawn ( priority: optPriority, operation: operation)
231
+ }
232
+
223
233
/// Add a child task to the group.
224
234
///
225
235
/// ### Error handling
@@ -236,7 +246,7 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
236
246
/// - `true` if the operation was added to the group successfully,
237
247
/// `false` otherwise (e.g. because the group `isCancelled`)
238
248
public mutating func spawn(
239
- priority: Task . Priority = . unspecified ,
249
+ priority: Task . Priority ? = nil ,
240
250
operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
241
251
) {
242
252
_ = _taskGroupAddPendingTask ( group: _group, unconditionally: true )
@@ -260,6 +270,16 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
260
270
_enqueueJobGlobal ( Builtin . convertTaskToJob ( childTask) )
261
271
}
262
272
273
+ // Historical entry point, maintained for ABI compatibility
274
+ @usableFromInline
275
+ mutating func spawnUnlessCancelled(
276
+ priority: Task . Priority = . unspecified,
277
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
278
+ ) -> Bool {
279
+ let optPriority : Task . Priority ? = priority
280
+ return spawnUnlessCancelled ( priority: optPriority, operation: operation)
281
+ }
282
+
263
283
/// Add a child task to the group.
264
284
///
265
285
/// ### Error handling
@@ -276,7 +296,7 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
276
296
/// - `true` if the operation was added to the group successfully,
277
297
/// `false` otherwise (e.g. because the group `isCancelled`)
278
298
public mutating func spawnUnlessCancelled(
279
- priority: Task . Priority = . unspecified ,
299
+ priority: Task . Priority ? = nil ,
280
300
operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
281
301
) -> Bool {
282
302
let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
@@ -472,6 +492,16 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
472
492
}
473
493
}
474
494
495
+ // Historical entry point for ABI reasons
496
+ @usableFromInline
497
+ mutating func spawn(
498
+ priority: Task . Priority = . unspecified,
499
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
500
+ ) {
501
+ let optPriority : Task . Priority ? = priority
502
+ return spawn ( priority: optPriority, operation: operation)
503
+ }
504
+
475
505
/// Spawn, unconditionally, a child task in the group.
476
506
///
477
507
/// ### Error handling
@@ -488,7 +518,7 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
488
518
/// - `true` if the operation was added to the group successfully,
489
519
/// `false` otherwise (e.g. because the group `isCancelled`)
490
520
public mutating func spawn(
491
- priority: Task . Priority = . unspecified ,
521
+ priority: Task . Priority ? = nil ,
492
522
operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
493
523
) {
494
524
// we always add, so no need to check if group was cancelled
@@ -513,6 +543,16 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
513
543
_enqueueJobGlobal ( Builtin . convertTaskToJob ( childTask) )
514
544
}
515
545
546
+ // Historical entry point for ABI reasons
547
+ @usableFromInline
548
+ mutating func spawnUnlessCancelled(
549
+ priority: Task . Priority ,
550
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
551
+ ) -> Bool {
552
+ let optPriority : Task . Priority ? = priority
553
+ return spawnUnlessCancelled ( priority: optPriority, operation: operation)
554
+ }
555
+
516
556
/// Add a child task to the group.
517
557
///
518
558
/// ### Error handling
@@ -529,7 +569,7 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
529
569
/// - `true` if the operation was added to the group successfully,
530
570
/// `false` otherwise (e.g. because the group `isCancelled`)
531
571
public mutating func spawnUnlessCancelled(
532
- priority: Task . Priority = . unspecified ,
572
+ priority: Task . Priority ? = nil ,
533
573
operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
534
574
) -> Bool {
535
575
let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
0 commit comments