@@ -186,152 +186,6 @@ public struct DiscardingTaskGroup {
186186 let _: Void ? = try await _taskGroupWaitAll ( group: _group, bodyError: nil )
187187 }
188188
189- /// Adds a child task to the group.
190- ///
191- /// - Parameters:
192- /// - priority: The priority of the operation task.
193- /// Omit this parameter or pass `.unspecified`
194- /// to set the child task's priority to the priority of the group.
195- /// - operation: The operation to execute as part of the task group.
196- @_alwaysEmitIntoClient
197- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
198- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
199- #endif
200- public mutating func addTask(
201- priority: TaskPriority ? = nil ,
202- operation: sending @escaping @isolated ( any) ( ) async -> Void
203- ) {
204- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
205- let flags = taskCreateFlags (
206- priority: priority, isChildTask: true , copyTaskLocals: false ,
207- inheritContext: false , enqueueJob: false ,
208- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
209- )
210- #else
211- let flags = taskCreateFlags (
212- priority: priority, isChildTask: true , copyTaskLocals: false ,
213- inheritContext: false , enqueueJob: true ,
214- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
215- )
216- #endif
217-
218- // Create the task in this group.
219- let builtinSerialExecutor =
220- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
221-
222- _ = Builtin . createDiscardingTask ( flags: flags,
223- initialSerialExecutor: builtinSerialExecutor,
224- taskGroup: _group,
225- operation: operation)
226- }
227-
228- /// Adds a child task to the group, unless the group has been canceled.
229- ///
230- /// - Parameters:
231- /// - priority: The priority of the operation task.
232- /// Omit this parameter or pass `.unspecified`
233- /// to set the child task's priority to the priority of the group.
234- /// - operation: The operation to execute as part of the task group.
235- /// - Returns: `true` if the child task was added to the group;
236- /// otherwise `false`.
237- @_alwaysEmitIntoClient
238- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
239- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
240- #endif
241- public mutating func addTaskUnlessCancelled(
242- priority: TaskPriority ? = nil ,
243- operation: sending @escaping @isolated ( any) ( ) async -> Void
244- ) -> Bool {
245- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
246-
247- guard canAdd else {
248- // the group is cancelled and is not accepting any new work
249- return false
250- }
251- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
252- let flags = taskCreateFlags (
253- priority: priority, isChildTask: true , copyTaskLocals: false ,
254- inheritContext: false , enqueueJob: false ,
255- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
256- )
257- #else
258- let flags = taskCreateFlags (
259- priority: priority, isChildTask: true , copyTaskLocals: false ,
260- inheritContext: false , enqueueJob: true ,
261- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
262- )
263- #endif
264-
265- // Create the task in this group.
266- let builtinSerialExecutor =
267- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
268-
269- _ = Builtin . createDiscardingTask ( flags: flags,
270- initialSerialExecutor: builtinSerialExecutor,
271- taskGroup: _group,
272- operation: operation)
273-
274- return true
275- }
276-
277- @_alwaysEmitIntoClient
278- public mutating func addTask(
279- operation: sending @escaping @isolated ( any) ( ) async -> Void
280- ) {
281- let flags = taskCreateFlags (
282- priority: nil , isChildTask: true , copyTaskLocals: false ,
283- inheritContext: false , enqueueJob: true ,
284- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
285- )
286-
287- // Create the task in this group.
288- let builtinSerialExecutor =
289- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
290-
291- _ = Builtin . createDiscardingTask ( flags: flags,
292- initialSerialExecutor: builtinSerialExecutor,
293- taskGroup: _group,
294- operation: operation)
295- }
296-
297- /// Adds a child task to the group, unless the group has been canceled.
298- ///
299- /// - Parameters:
300- /// - operation: The operation to execute as part of the task group.
301- /// - Returns: `true` if the child task was added to the group;
302- /// otherwise `false`.
303- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
304- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTaskUnlessCancelled(operation:) " )
305- #endif
306- @_alwaysEmitIntoClient
307- public mutating func addTaskUnlessCancelled(
308- operation: sending @escaping @isolated ( any) ( ) async -> Void
309- ) -> Bool {
310- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
311-
312- guard canAdd else {
313- // the group is cancelled and is not accepting any new work
314- return false
315- }
316-
317- let flags = taskCreateFlags (
318- priority: nil , isChildTask: true , copyTaskLocals: false ,
319- inheritContext: false , enqueueJob: true ,
320- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
321- )
322-
323- // Create the task in this group.
324- let builtinSerialExecutor =
325- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
326-
327- _ = Builtin . createDiscardingTask ( flags: flags,
328- initialSerialExecutor: builtinSerialExecutor,
329- taskGroup: _group,
330- operation: operation)
331-
332- return true
333- }
334-
335189 /// A Boolean value that indicates whether the group has any remaining tasks.
336190 ///
337191 /// At the start of the body of a `withDiscardingTaskGroup(of:returning:body:)` call,
@@ -624,63 +478,6 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
624478 let _: Void ? = try await _taskGroupWaitAll ( group: _group, bodyError: bodyError)
625479 }
626480
627- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
628- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
629- #endif
630- @_alwaysEmitIntoClient
631- public mutating func addTask(
632- priority: TaskPriority ? = nil ,
633- operation: sending @escaping @isolated ( any) ( ) async throws -> Void
634- ) {
635- let flags = taskCreateFlags (
636- priority: priority, isChildTask: true , copyTaskLocals: false ,
637- inheritContext: false , enqueueJob: true ,
638- addPendingGroupTaskUnconditionally: true , isDiscardingTask: true
639- )
640-
641- // Create the task in this group.
642- let builtinSerialExecutor =
643- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
644-
645- _ = Builtin . createDiscardingTask ( flags: flags,
646- initialSerialExecutor: builtinSerialExecutor,
647- taskGroup: _group,
648- operation: operation)
649- }
650-
651- #if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
652- @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " , renamed: " addTask(operation:) " )
653- #endif
654- @_alwaysEmitIntoClient
655- public mutating func addTaskUnlessCancelled(
656- priority: TaskPriority ? = nil ,
657- operation: sending @escaping @isolated ( any) ( ) async throws -> Void
658- ) -> Bool {
659- let canAdd = _taskGroupAddPendingTask ( group: _group, unconditionally: false )
660-
661- guard canAdd else {
662- // the group is cancelled and is not accepting any new work
663- return false
664- }
665-
666- let flags = taskCreateFlags (
667- priority: priority, isChildTask: true , copyTaskLocals: false ,
668- inheritContext: false , enqueueJob: true ,
669- addPendingGroupTaskUnconditionally: false , isDiscardingTask: true
670- )
671-
672- // Create the task in this group.
673- let builtinSerialExecutor =
674- Builtin . extractFunctionIsolation ( operation) ? . unownedExecutor. executor
675-
676- _ = Builtin . createDiscardingTask ( flags: flags,
677- initialSerialExecutor: builtinSerialExecutor,
678- taskGroup: _group,
679- operation: operation)
680-
681- return true
682- }
683-
684481 /// A Boolean value that indicates whether the group has any remaining tasks.
685482 ///
686483 /// At the start of the body of a `withThrowingDiscardingTaskGroup(returning:body:)` call,
0 commit comments