@@ -184,159 +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
- /// Adds a child task to the group.
192
- ///
193
- /// - Parameters:
194
- /// - priority: The priority of the operation task.
195
- /// Omit this parameter or pass `.unspecified`
196
- /// to set the child task's priority to the priority of the group.
197
- /// - operation: The operation to execute as part of the task group.
198
- @_alwaysEmitIntoClient
199
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
200
- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
201
- #endif
202
- public mutating func addTask(
203
- priority: TaskPriority ? = nil ,
204
- operation: sending @escaping @isolated ( any) ( ) async -> Void
205
- ) {
206
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
207
- let flags = taskCreateFlags (
208
- priority: priority, isChildTask: true , copyTaskLocals: false ,
209
- inheritContext: false , enqueueJob: false ,
210
- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
211
- )
212
- #else
213
- let flags = taskCreateFlags (
214
- priority: priority, isChildTask: true , copyTaskLocals: false ,
215
- inheritContext: false , enqueueJob: true ,
216
- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
217
- )
218
- #endif
219
-
220
- // Create the task in this group.
221
- let builtinSerialExecutor =
222
- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
223
-
224
- _ = Builtin . createDiscardingTask ( flags: flags,
225
- initialSerialExecutor: builtinSerialExecutor,
226
- taskGroup: _group,
227
- operation: operation)
228
- }
229
-
230
- /// Adds a child task to the group, unless the group has been canceled.
231
- ///
232
- /// - Parameters:
233
- /// - priority: The priority of the operation task.
234
- /// Omit this parameter or pass `.unspecified`
235
- /// to set the child task's priority to the priority of the group.
236
- /// - operation: The operation to execute as part of the task group.
237
- /// - Returns: `true` if the child task was added to the group;
238
- /// otherwise `false`.
239
- @_alwaysEmitIntoClient
240
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
241
- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
242
- #endif
243
- public mutating func addTaskUnlessCancelled(
244
- priority: TaskPriority ? = nil ,
245
- operation: sending @escaping @isolated ( any) ( ) async -> Void
246
- ) -> Bool {
247
- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
248
-
249
- guard canAdd else {
250
- // the group is cancelled and is not accepting any new work
251
- return false
252
- }
253
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
254
- let flags = taskCreateFlags (
255
- priority: priority, isChildTask: true , copyTaskLocals: false ,
256
- inheritContext: false , enqueueJob: false ,
257
- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
258
- )
259
- #else
260
- let flags = taskCreateFlags (
261
- priority: priority, isChildTask: true , copyTaskLocals: false ,
262
- inheritContext: false , enqueueJob: true ,
263
- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
264
- )
265
- #endif
266
-
267
- // Create the task in this group.
268
- let builtinSerialExecutor =
269
- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
270
-
271
- _ = Builtin . createDiscardingTask ( flags: flags,
272
- initialSerialExecutor: builtinSerialExecutor,
273
- taskGroup: _group,
274
- operation: operation)
275
-
276
- return true
277
- }
278
-
279
- @_alwaysEmitIntoClient
280
- public mutating func addTask(
281
- operation: sending @escaping @isolated ( any) ( ) async -> Void
282
- ) {
283
- let flags = taskCreateFlags (
284
- priority: nil , isChildTask: true , copyTaskLocals: false ,
285
- inheritContext: false , enqueueJob: true ,
286
- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
287
- )
288
-
289
- // Create the task in this group.
290
- let builtinSerialExecutor =
291
- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
292
-
293
- _ = Builtin . createDiscardingTask ( flags: flags,
294
- initialSerialExecutor: builtinSerialExecutor,
295
- taskGroup: _group,
296
- operation: operation)
297
- }
298
-
299
- /// Adds a child task to the group, unless the group has been canceled.
300
- ///
301
- /// - Parameters:
302
- /// - operation: The operation to execute as part of the task group.
303
- /// - Returns: `true` if the child task was added to the group;
304
- /// otherwise `false`.
305
- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
306
- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTaskUnlessCancelled(operation:) " )
307
- #endif
308
- @_alwaysEmitIntoClient
309
- public mutating func addTaskUnlessCancelled(
310
- operation: sending @escaping @isolated ( any) ( ) async -> Void
311
- ) -> Bool {
312
- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
313
-
314
- guard canAdd else {
315
- // the group is cancelled and is not accepting any new work
316
- return false
317
- }
318
-
319
- let flags = taskCreateFlags (
320
- priority: nil , isChildTask: true , copyTaskLocals: false ,
321
- inheritContext: false , enqueueJob: true ,
322
- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
323
- )
324
-
325
- // Create the task in this group.
326
- let builtinSerialExecutor =
327
- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
328
-
329
- _ = Builtin . createDiscardingTask ( flags: flags,
330
- initialSerialExecutor: builtinSerialExecutor,
331
- taskGroup: _group,
332
- operation: operation)
333
-
334
- return true
335
- }
336
-
337
- // The Embedded clones of the task-creation routines.
338
- #else
339
-
340
187
/// Adds a child task to the group.
341
188
///
342
189
/// - Parameters:
@@ -459,8 +306,6 @@ public struct DiscardingTaskGroup {
459
306
return true
460
307
}
461
308
462
- #endif // $Embedded
463
-
464
309
/// A Boolean value that indicates whether the group has any remaining tasks.
465
310
///
466
311
/// At the start of the body of a `withDiscardingTaskGroup(of:returning:body:)` call,
0 commit comments