Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)

Co-authored-by: John McCall <rjmccall@gmail.com>
This commit is contained in:
Konrad `ktoso` Malawski
2023-12-12 17:14:24 +09:00
committed by GitHub
parent 7a3e3aea15
commit 828f589be4
68 changed files with 2680 additions and 277 deletions

View File

@@ -2437,6 +2437,7 @@ public:
/// Flags for schedulable jobs.
class JobFlags : public FlagSet<uint32_t> {
public:
// clang-format off
enum {
Kind = 0,
Kind_width = 8,
@@ -2448,12 +2449,14 @@ public:
// Kind-specific flags.
Task_IsChildTask = 24,
Task_IsFuture = 25,
Task_IsGroupChildTask = 26,
Task_IsChildTask = 24,
Task_IsFuture = 25,
Task_IsGroupChildTask = 26,
// 27 is currently unused
Task_IsAsyncLetTask = 28,
Task_IsAsyncLetTask = 28,
Task_HasInitialTaskExecutorPreference = 29,
};
// clang-format on
explicit JobFlags(uint32_t bits) : FlagSet(bits) {}
JobFlags(JobKind kind) { setKind(kind); }
@@ -2485,6 +2488,9 @@ public:
FLAGSET_DEFINE_FLAG_ACCESSORS(Task_IsAsyncLetTask,
task_isAsyncLetTask,
task_setIsAsyncLetTask)
FLAGSET_DEFINE_FLAG_ACCESSORS(Task_HasInitialTaskExecutorPreference,
task_hasInitialTaskExecutorPreference,
task_setHasInitialTaskExecutorPreference)
};
/// Kinds of task status record.
@@ -2510,6 +2516,10 @@ enum class TaskStatusRecordKind : uint8_t {
/// escalated.
EscalationNotification = 4,
/// A task executor preference, which may impact what executor a task will be
/// enqueued on.
TaskExecutorPreference = 5,
// Kinds >= 192 are private to the implementation.
First_Reserved = 192,
Private_RecordLock = 192
@@ -2518,12 +2528,12 @@ enum class TaskStatusRecordKind : uint8_t {
/// Kinds of option records that can be passed to creating asynchronous tasks.
enum class TaskOptionRecordKind : uint8_t {
/// Request a task to be kicked off, or resumed, on a specific executor.
Executor = 0,
InitialTaskExecutor = 0,
/// Request a child task to be part of a specific task group.
TaskGroup = 1,
/// DEPRECATED. AsyncLetWithBuffer is used instead.
/// Request a child task for an 'async let'.
AsyncLet = 2,
AsyncLet = 2,
/// Request a child task for an 'async let'.
AsyncLetWithBuffer = 3,
/// Information about the result type of the task, used in embedded Swift.