@@ -274,6 +274,108 @@ extension Task where Success == Never, Failure == Never {
274
274
}
275
275
}
276
276
277
+
278
+ @available ( SwiftStdlib 5 . 1 , * )
279
+ extension TaskGroup {
280
+ @available ( SwiftStdlib 5 . 1 , * )
281
+ @available ( * , deprecated, renamed: " addTaskUnlessCancelled(priority:operation:) " )
282
+ @_alwaysEmitIntoClient
283
+ public mutating func add(
284
+ priority: TaskPriority ? = nil ,
285
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
286
+ ) async -> Bool {
287
+ return self . addTaskUnlessCancelled ( priority: priority) {
288
+ await operation ( )
289
+ }
290
+ }
291
+
292
+ @available ( * , deprecated, renamed: " addTask(priority:operation:) " )
293
+ @_alwaysEmitIntoClient
294
+ public mutating func spawn(
295
+ priority: TaskPriority ? = nil ,
296
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
297
+ ) {
298
+ self . addTask ( priority: priority, operation: operation)
299
+ }
300
+
301
+ @available ( * , deprecated, renamed: " addTaskUnlessCancelled(priority:operation:) " )
302
+ @_alwaysEmitIntoClient
303
+ public mutating func spawnUnlessCancelled(
304
+ priority: TaskPriority ? = nil ,
305
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
306
+ ) -> Bool {
307
+ addTaskUnlessCancelled ( priority: priority, operation: operation)
308
+ }
309
+
310
+ @available ( * , deprecated, renamed: " addTask(priority:operation:) " )
311
+ @_alwaysEmitIntoClient
312
+ public mutating func async (
313
+ priority: TaskPriority ? = nil ,
314
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
315
+ ) {
316
+ addTask ( priority: priority, operation: operation)
317
+ }
318
+
319
+ @available ( * , deprecated, renamed: " addTaskUnlessCancelled(priority:operation:) " )
320
+ @_alwaysEmitIntoClient
321
+ public mutating func asyncUnlessCancelled(
322
+ priority: TaskPriority ? = nil ,
323
+ operation: __owned @Sendable @escaping ( ) async -> ChildTaskResult
324
+ ) -> Bool {
325
+ addTaskUnlessCancelled ( priority: priority, operation: operation)
326
+ }
327
+ }
328
+
329
+ @available ( SwiftStdlib 5 . 1 , * )
330
+ extension ThrowingTaskGroup {
331
+ @available ( * , deprecated, renamed: " addTask(priority:operation:) " )
332
+ @_alwaysEmitIntoClient
333
+ public mutating func add(
334
+ priority: TaskPriority ? = nil ,
335
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
336
+ ) async -> Bool {
337
+ return self . addTaskUnlessCancelled ( priority: priority) {
338
+ try await operation ( )
339
+ }
340
+ }
341
+
342
+ @available ( * , deprecated, renamed: " addTask(priority:operation:) " )
343
+ @_alwaysEmitIntoClient
344
+ public mutating func spawn(
345
+ priority: TaskPriority ? = nil ,
346
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
347
+ ) {
348
+ addTask ( priority: priority, operation: operation)
349
+ }
350
+
351
+ @available ( * , deprecated, renamed: " addTaskUnlessCancelled(priority:operation:) " )
352
+ @_alwaysEmitIntoClient
353
+ public mutating func spawnUnlessCancelled(
354
+ priority: TaskPriority ? = nil ,
355
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
356
+ ) -> Bool {
357
+ addTaskUnlessCancelled ( priority: priority, operation: operation)
358
+ }
359
+
360
+ @available ( * , deprecated, renamed: " addTask(priority:operation:) " )
361
+ @_alwaysEmitIntoClient
362
+ public mutating func async (
363
+ priority: TaskPriority ? = nil ,
364
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
365
+ ) {
366
+ addTask ( priority: priority, operation: operation)
367
+ }
368
+
369
+ @available ( * , deprecated, renamed: " addTaskUnlessCancelled(priority:operation:) " )
370
+ @_alwaysEmitIntoClient
371
+ public mutating func asyncUnlessCancelled(
372
+ priority: TaskPriority ? = nil ,
373
+ operation: __owned @Sendable @escaping ( ) async throws -> ChildTaskResult
374
+ ) -> Bool {
375
+ addTaskUnlessCancelled ( priority: priority, operation: operation)
376
+ }
377
+ }
378
+
277
379
@available ( SwiftStdlib 5 . 1 , * )
278
380
extension Task {
279
381
@available ( * , deprecated, message: " get() has been replaced by .value " )
0 commit comments