Skip to content

Commit fba8cca

Browse files
committed
[Concurrency] Perform userInitiated adjustment after determining priority.
Based on feedback, perform the adjustment from userInteractive to userInitiated all the time, and rely on `qos_class_self` whenever we don't have a task.
1 parent 9df8944 commit fba8cca

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,12 @@ static bool isExecutingOnMainThread() {
264264
}
265265

266266
JobPriority swift::swift_task_getCurrentThreadPriority() {
267-
if (isExecutingOnMainThread())
268-
return JobPriority::UserInitiated;
269-
270267
#if defined(__APPLE__)
271268
return static_cast<JobPriority>(qos_class_self());
272269
#else
270+
if (isExecutingOnMainThread())
271+
return JobPriority::UserInitiated;
272+
273273
return JobPriority::Unspecified;
274274
#endif
275275
}

stdlib/public/Concurrency/Task.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,10 @@ public func async(
473473
actualPriority = priority
474474
}
475475

476+
let adjustedPriority = actualPriority == .userInteractive
477+
? .userInitiated
478+
: actualPriority
479+
476480
// Set up the job flags for a new task.
477481
var flags = Task.JobFlags()
478482
flags.kind = .task

0 commit comments

Comments
 (0)