|
45 | 45 | #include <android/log.h>
|
46 | 46 | #endif
|
47 | 47 |
|
| 48 | +#if __has_include(<unistd.h>) |
| 49 | +#include <unistd.h> |
| 50 | +#endif |
| 51 | + |
48 | 52 | #if defined(_WIN32)
|
49 | 53 | #include <io.h>
|
50 | 54 | #endif
|
@@ -568,10 +572,10 @@ struct TaskGroupStatus {
|
568 | 572 | #if defined(_WIN32)
|
569 | 573 | #define STDERR_FILENO 2
|
570 | 574 | _write(STDERR_FILENO, message, strlen(message));
|
571 |
| -#else |
| 575 | +#elif defined(STDERR_FILENO) |
572 | 576 | write(STDERR_FILENO, message, strlen(message));
|
573 | 577 | #endif
|
574 |
| -#if defined(__APPLE__) |
| 578 | +#if defined(SWIFT_STDLIB_HAS_ASL) |
575 | 579 | asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
|
576 | 580 | #elif defined(__ANDROID__)
|
577 | 581 | __android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", message);
|
@@ -1078,6 +1082,15 @@ static void _enqueueCompletedTask(NaiveTaskGroupQueue<ReadyQueueItem> *readyQueu
|
1078 | 1082 | readyQueue->enqueue(readyItem);
|
1079 | 1083 | }
|
1080 | 1084 |
|
| 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 | + |
1081 | 1094 | // TaskGroup is locked upon entry and exit
|
1082 | 1095 | void AccumulatingTaskGroup::enqueueCompletedTask(AsyncTask *completedTask, bool hadErrorResult) {
|
1083 | 1096 | // Retain the task while it is in the queue; it must remain alive until
|
|
0 commit comments