@@ -145,9 +145,12 @@ FutureFragment::Status AsyncTask::waitFuture(AsyncTask *waitingTask,
145145 queueHead, newQueueHead,
146146 /* success*/ std::memory_order_release,
147147 /* failure*/ std::memory_order_acquire)) {
148+
148149 // Escalate the priority of this task based on the priority
149150 // of the waiting task.
150- swift_task_escalate (this , waitingTask->Flags .getPriority ());
151+ auto status = waitingTask->_private ().Status .load (std::memory_order_relaxed);
152+ swift_task_escalate (this , status.getStoredPriority ());
153+
151154 _swift_task_clearCurrent ();
152155 return FutureFragment::Status::Executing;
153156 }
@@ -231,7 +234,7 @@ void AsyncTask::completeFuture(AsyncContext *context) {
231234
232235 // Enqueue the waiter on the global executor.
233236 // TODO: allow waiters to fill in a suggested executor
234- swift_task_enqueueGlobal ( waitingTask);
237+ waitingTask-> flagAsEnqueuedOnExecutor ( ExecutorRef::generic () );
235238
236239 // Move to the next task.
237240 waitingTask = nextWaitingTask;
@@ -649,12 +652,7 @@ static AsyncTaskAndContext swift_task_create_commonImpl(
649652 basePriority = JobPriority::Default;
650653 }
651654
652- SWIFT_TASK_DEBUG_LOG (" Task's base priority = %d" , basePriority);
653-
654- // TODO (rokhinip): Figure out the semantics of the job priority and where
655- // it ought to be set conclusively - seems like it ought to be at enqueue
656- // time. For now, maintain current semantics of setting jobPriority as well.
657- jobFlags.setPriority (basePriority);
655+ SWIFT_TASK_DEBUG_LOG (" Task's base priority = %#x" , basePriority);
658656
659657 // Figure out the size of the header.
660658 size_t headerSize = sizeof (AsyncTask);
@@ -849,7 +847,7 @@ static AsyncTaskAndContext swift_task_create_commonImpl(
849847 // If we're supposed to enqueue the task, do so now.
850848 if (taskCreateFlags.enqueueJob ()) {
851849 swift_retain (task);
852- swift_task_enqueue ( task, executor);
850+ task-> flagAsEnqueuedOnExecutor ( executor);
853851 }
854852
855853 return {task, initialContext};
@@ -1018,6 +1016,13 @@ static AsyncTask *swift_task_suspendImpl() {
10181016 return task;
10191017}
10201018
1019+ SWIFT_CC (swift)
1020+ static void
1021+ swift_task_enqueueTaskOnExecutorImpl(AsyncTask *task, ExecutorRef executor)
1022+ {
1023+ task->flagAsEnqueuedOnExecutor (executor);
1024+ }
1025+
10211026SWIFT_CC (swift)
10221027static AsyncTask *swift_continuation_initImpl(ContinuationAsyncContext *context,
10231028 AsyncContinuationFlags flags) {
@@ -1146,7 +1151,7 @@ static void resumeTaskAfterContinuation(AsyncTask *task,
11461151 // to make a stronger best-effort attempt to catch racing attempts to
11471152 // resume the continuation?
11481153
1149- swift_task_enqueue ( task, context->ResumeToExecutor );
1154+ task-> flagAsEnqueuedOnExecutor ( context->ResumeToExecutor );
11501155}
11511156
11521157SWIFT_CC (swift)
0 commit comments