Skip to content

Commit 041d9de

Browse files
ktosodrexin
andauthored
[5.8][Concurrency] Add include of unistd.h to TaskGroup.cpp (#63344)
Co-authored-by: Dario Rexin <[email protected]>
1 parent b1b89ca commit 041d9de

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
#include <android/log.h>
4646
#endif
4747

48+
#if __has_include(<unistd.h>)
49+
#include <unistd.h>
50+
#endif
51+
4852
#if defined(_WIN32)
4953
#include <io.h>
5054
#endif
@@ -568,10 +572,10 @@ struct TaskGroupStatus {
568572
#if defined(_WIN32)
569573
#define STDERR_FILENO 2
570574
_write(STDERR_FILENO, message, strlen(message));
571-
#else
575+
#elif defined(STDERR_FILENO)
572576
write(STDERR_FILENO, message, strlen(message));
573577
#endif
574-
#if defined(__APPLE__)
578+
#if defined(SWIFT_STDLIB_HAS_ASL)
575579
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
576580
#elif defined(__ANDROID__)
577581
__android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", message);
@@ -1078,6 +1082,15 @@ static void _enqueueCompletedTask(NaiveTaskGroupQueue<ReadyQueueItem> *readyQueu
10781082
readyQueue->enqueue(readyItem);
10791083
}
10801084

1085+
#if SWIFT_CONCURRENCY_TASK_TO_THREAD_MODEL
1086+
static void _enqueueRawError(DiscardingTaskGroup *group,
1087+
NaiveTaskGroupQueue<ReadyQueueItem> *readyQueue,
1088+
SwiftError *error) {
1089+
auto readyItem = ReadyQueueItem::getRawError(group, error);
1090+
readyQueue->enqueue(readyItem);
1091+
}
1092+
#endif
1093+
10811094
// TaskGroup is locked upon entry and exit
10821095
void AccumulatingTaskGroup::enqueueCompletedTask(AsyncTask *completedTask, bool hadErrorResult) {
10831096
// Retain the task while it is in the queue; it must remain alive until

0 commit comments

Comments
 (0)