@@ -1060,6 +1060,15 @@ static void _enqueueCompletedTask(NaiveTaskGroupQueue<ReadyQueueItem> *readyQueu
1060
1060
readyQueue->enqueue (readyItem);
1061
1061
}
1062
1062
1063
+ // / This can only be used by a discarding task group;
1064
+ // / Other groups must enqueue a complete Task to the ready queue.
1065
+ static void _enqueueRawError (DiscardingTaskGroup* _Nonnull group,
1066
+ NaiveTaskGroupQueue<ReadyQueueItem> *readyQueue,
1067
+ SwiftError *error) {
1068
+ auto readyItem = ReadyQueueItem::getRawError (group, error);
1069
+ readyQueue->enqueue (readyItem);
1070
+ }
1071
+
1063
1072
// TaskGroup is locked upon entry and exit
1064
1073
void AccumulatingTaskGroup::enqueueCompletedTask (AsyncTask *completedTask, bool hadErrorResult) {
1065
1074
// Retain the task while it is in the queue; it must remain alive until
@@ -1233,6 +1242,7 @@ void DiscardingTaskGroup::offer(AsyncTask *completedTask, AsyncContext *context)
1233
1242
}
1234
1243
1235
1244
auto afterComplete = statusCompletePendingAssumeRelease ();
1245
+ (void )afterComplete; // silence "not used" warning
1236
1246
SWIFT_TASK_GROUP_DEBUG_LOG (this , " offer, either more pending tasks, or no waiting task, status:%s" ,
1237
1247
afterComplete.to_string (this ).c_str ());
1238
1248
}
@@ -1348,7 +1358,7 @@ void DiscardingTaskGroup::resumeWaitingTaskWithError(
1348
1358
// we can't just have the parent task set itself up as a waiter.
1349
1359
// But since it's what we're doing, we basically take the same
1350
1360
// path as we would if there wasn't a waiter.
1351
- enqueueCompletedTask (completedTask, hadErrorResult );
1361
+ _enqueueRawError ( this , &readyQueue, error );
1352
1362
return ;
1353
1363
1354
1364
#else /* SWIFT_CONCURRENCY_TASK_TO_THREAD_MODEL */
0 commit comments