@@ -1053,6 +1053,15 @@ static void _enqueueCompletedTask(NaiveTaskGroupQueue<ReadyQueueItem> *readyQueu
1053
1053
readyQueue->enqueue (readyItem);
1054
1054
}
1055
1055
1056
+ // / This can only be used by a discarding task group;
1057
+ // / Other groups must enqueue a complete Task to the ready queue.
1058
+ static void _enqueueRawError (DiscardingTaskGroup* _Nonnull group,
1059
+ NaiveTaskGroupQueue<ReadyQueueItem> *readyQueue,
1060
+ SwiftError *error) {
1061
+ auto readyItem = ReadyQueueItem::getRawError (group, error);
1062
+ readyQueue->enqueue (readyItem);
1063
+ }
1064
+
1056
1065
// TaskGroup is locked upon entry and exit
1057
1066
void AccumulatingTaskGroup::enqueueCompletedTask (AsyncTask *completedTask, bool hadErrorResult) {
1058
1067
// Retain the task while it is in the queue; it must remain alive until
@@ -1226,6 +1235,7 @@ void DiscardingTaskGroup::offer(AsyncTask *completedTask, AsyncContext *context)
1226
1235
}
1227
1236
1228
1237
auto afterComplete = statusCompletePendingAssumeRelease ();
1238
+ (void )afterComplete; // silence "not used" warning
1229
1239
SWIFT_TASK_GROUP_DEBUG_LOG (this , " offer, either more pending tasks, or no waiting task, status:%s" ,
1230
1240
afterComplete.to_string (this ).c_str ());
1231
1241
}
@@ -1341,7 +1351,7 @@ void DiscardingTaskGroup::resumeWaitingTaskWithError(
1341
1351
// we can't just have the parent task set itself up as a waiter.
1342
1352
// But since it's what we're doing, we basically take the same
1343
1353
// path as we would if there wasn't a waiter.
1344
- enqueueCompletedTask (completedTask, hadErrorResult );
1354
+ _enqueueRawError ( this , &readyQueue, error );
1345
1355
return ;
1346
1356
1347
1357
#else /* SWIFT_CONCURRENCY_TASK_TO_THREAD_MODEL */
0 commit comments