Skip to content

Commit 6f38910

Browse files
committed
DiscardingTaskGroup now shares some implementation with "Accumulating" TaskGroup
1 parent e37b998 commit 6f38910

File tree

9 files changed

+975
-437
lines changed

9 files changed

+975
-437
lines changed

include/swift/ABI/TaskGroup.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ class alignas(Alignment_TaskGroup) TaskGroup {
5454

5555
// Provide accessor for task group's status record
5656
TaskGroupTaskStatusRecord *getTaskRecord();
57+
58+
/// The group is a `TaskGroup` that accumulates results.
59+
bool isAccumulatingResults() {
60+
return !isDiscardingResults();
61+
}
62+
63+
/// The group is a `DiscardingTaskGroup` that discards results.
64+
bool isDiscardingResults();
5765
};
5866

5967
} // end namespace swift

include/swift/Runtime/Concurrency.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,6 @@ void swift_taskGroup_cancelAll(TaskGroup *group);
289289
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
290290
bool swift_taskGroup_isCancelled(TaskGroup *group);
291291

292-
/// Check if the task group is discarding results or not.
293-
///
294-
/// This can be called from any thread. Its Swift signature is
295-
///
296-
/// \code
297-
/// func swift_taskGroup_isDiscardingResults(group: Builtin.RawPointer)
298-
/// \endcode
299-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
300-
bool swift_taskGroup_isDiscardingResults(TaskGroup *group);
301-
302292
/// Wait until all pending tasks from the task group have completed.
303293
/// If this task group is accumulating results, this also discards all those results.
304294
///

stdlib/public/BackDeployConcurrency/CompatibilityOverrideConcurrency.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,6 @@ OVERRIDE_TASK_GROUP(taskGroup_isCancelled, bool,
273273
SWIFT_EXPORT_FROM(swift_Concurrency), SWIFT_CC(swift),
274274
swift::, (TaskGroup *group), (group))
275275

276-
OVERRIDE_TASK_GROUP(taskGroup_isDiscardingResults, bool,
277-
SWIFT_EXPORT_FROM(swift_Concurrency), SWIFT_CC(swift),
278-
swift::, (TaskGroup *group), (group))
279-
280276
OVERRIDE_TASK_GROUP(taskGroup_wait_all, void,
281277
SWIFT_EXPORT_FROM(swift_Concurrency), SWIFT_CC(swiftasync),
282278
swift::,

stdlib/public/BackDeployConcurrency/TaskGroup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ static TaskGroup *asAbstract(TaskGroupImpl *group) {
465465
return reinterpret_cast<TaskGroup*>(group);
466466
}
467467

468-
TaskGroupTaskStatusRecord * TaskGroup::getTaskRecord() {
469-
return asImpl(this)->getTaskRecord();
468+
TaskGroupTaskStatusRecord *TaskGroup::getTaskRecord() {
469+
return asImpl(this)->getTaskRecord();
470470
}
471471

472472
// =============================================================================

stdlib/public/CompatibilityOverride/CompatibilityOverrideConcurrency.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,6 @@ OVERRIDE_TASK_GROUP(taskGroup_isCancelled, bool,
307307
SWIFT_EXPORT_FROM(swift_Concurrency), SWIFT_CC(swift),
308308
swift::, (TaskGroup *group), (group))
309309

310-
OVERRIDE_TASK_GROUP(taskGroup_isDiscardingResults, bool,
311-
SWIFT_EXPORT_FROM(swift_Concurrency), SWIFT_CC(swift),
312-
swift::, (TaskGroup *group), (group))
313-
314310
OVERRIDE_TASK_GROUP(taskGroup_cancelAll, void,
315311
SWIFT_EXPORT_FROM(swift_Concurrency), SWIFT_CC(swift),
316312
swift::, (TaskGroup *group), (group))

stdlib/public/Concurrency/DiscardingTaskGroup.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,3 @@ func _taskGroupWaitAll<T>(
552552
group: Builtin.RawPointer,
553553
bodyError: Error?
554554
) async throws -> T?
555-
556-
@available(SwiftStdlib 5.8, *) // FIXME: remove
557-
@_silgen_name("swift_taskGroup_isDiscardingResults")
558-
func _taskGroupIsDiscardingResults(group: Builtin.RawPointer) -> Bool

0 commit comments

Comments
 (0)