@@ -184,10 +184,6 @@ public struct DiscardingTaskGroup {
184
184
let _: Void ? = try await _taskGroupWaitAll ( group: _group, bodyError: nil )
185
185
}
186
186
187
- // Clone the task-creation routines in Embedded Swift so that we don't
188
- // introduce an implicit use of `any Actor`.
189
- #if !$Embedded
190
-
191
187
/// Adds a child task to the group.
192
188
///
193
189
/// - Parameters:
@@ -334,133 +330,6 @@ public struct DiscardingTaskGroup {
334
330
return true
335
331
}
336
332
337
- // The Embedded clones of the task-creation routines.
338
- #else
339
-
340
- /// Adds a child task to the group.
341
- ///
342
- /// - Parameters:
343
- /// - priority: The priority of the operation task.
344
- /// Omit this parameter or pass `.unspecified`
345
- /// to set the child task's priority to the priority of the group.
346
- /// - operation: The operation to execute as part of the task group.
347
- @_alwaysEmitIntoClient
348
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
349
- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
350
- #endif
351
- public mutating func addTask(
352
- priority: TaskPriority ? = nil ,
353
- operation: sending @escaping ( ) async -> Void
354
- ) {
355
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
356
- let flags = taskCreateFlags (
357
- priority: priority, isChildTask: true , copyTaskLocals: false ,
358
- inheritContext: false , enqueueJob: false ,
359
- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
360
- )
361
- #else
362
- let flags = taskCreateFlags (
363
- priority: priority, isChildTask: true , copyTaskLocals: false ,
364
- inheritContext: false , enqueueJob: true ,
365
- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
366
- )
367
- #endif
368
-
369
- // Create the task in this group.
370
- _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
371
- }
372
-
373
- /// Adds a child task to the group, unless the group has been canceled.
374
- ///
375
- /// - Parameters:
376
- /// - priority: The priority of the operation task.
377
- /// Omit this parameter or pass `.unspecified`
378
- /// to set the child task's priority to the priority of the group.
379
- /// - operation: The operation to execute as part of the task group.
380
- /// - Returns: `true` if the child task was added to the group;
381
- /// otherwise `false`.
382
- @_alwaysEmitIntoClient
383
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
384
- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
385
- #endif
386
- public mutating func addTaskUnlessCancelled(
387
- priority: TaskPriority ? = nil ,
388
- operation: sending @escaping ( ) async -> Void
389
- ) -> Bool {
390
- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
391
-
392
- guard canAdd else {
393
- // the group is cancelled and is not accepting any new work
394
- return false
395
- }
396
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
397
- let flags = taskCreateFlags (
398
- priority: priority, isChildTask: true , copyTaskLocals: false ,
399
- inheritContext: false , enqueueJob: false ,
400
- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
401
- )
402
- #else
403
- let flags = taskCreateFlags (
404
- priority: priority, isChildTask: true , copyTaskLocals: false ,
405
- inheritContext: false , enqueueJob: true ,
406
- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
407
- )
408
- #endif
409
-
410
- // Create the task in this group.
411
- _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
412
-
413
- return true
414
- }
415
-
416
- @_alwaysEmitIntoClient
417
- public mutating func addTask(
418
- operation: sending @escaping ( ) async -> Void
419
- ) {
420
- let flags = taskCreateFlags (
421
- priority: nil , isChildTask: true , copyTaskLocals: false ,
422
- inheritContext: false , enqueueJob: true ,
423
- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
424
- )
425
-
426
- // Create the task in this group.
427
- _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
428
- }
429
-
430
- /// Adds a child task to the group, unless the group has been canceled.
431
- ///
432
- /// - Parameters:
433
- /// - operation: The operation to execute as part of the task group.
434
- /// - Returns: `true` if the child task was added to the group;
435
- /// otherwise `false`.
436
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
437
- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTaskUnlessCancelled(operation:) " )
438
- #endif
439
- @_alwaysEmitIntoClient
440
- public mutating func addTaskUnlessCancelled(
441
- operation: sending @escaping ( ) async -> Void
442
- ) -> Bool {
443
- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
444
-
445
- guard canAdd else {
446
- // the group is cancelled and is not accepting any new work
447
- return false
448
- }
449
-
450
- let flags = taskCreateFlags (
451
- priority: nil , isChildTask: true , copyTaskLocals: false ,
452
- inheritContext: false , enqueueJob: true ,
453
- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
454
- )
455
-
456
- // Create the task in this group.
457
- _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
458
-
459
- return true
460
- }
461
-
462
- #endif // $Embedded
463
-
464
333
/// A Boolean value that indicates whether the group has any remaining tasks.
465
334
///
466
335
/// At the start of the body of a `withDiscardingTaskGroup(of:returning:body:)` call,
0 commit comments