Skip to content

Commit 05df53a

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. (cherry picked from commit fba8cca)
1 parent 271d92f commit 05df53a

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
@@ -261,12 +261,12 @@ static bool isExecutingOnMainThread() {
261261
}
262262

263263
JobPriority swift::swift_task_getCurrentThreadPriority() {
264-
if (isExecutingOnMainThread())
265-
return JobPriority::UserInitiated;
266-
267264
#if defined(__APPLE__)
268265
return static_cast<JobPriority>(qos_class_self());
269266
#else
267+
if (isExecutingOnMainThread())
268+
return JobPriority::UserInitiated;
269+
270270
return JobPriority::Unspecified;
271271
#endif
272272
}

stdlib/public/Concurrency/Task.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@ public func async(
540540
actualPriority = priority
541541
}
542542

543+
let adjustedPriority = actualPriority == .userInteractive
544+
? .userInitiated
545+
: actualPriority
546+
543547
// Set up the job flags for a new task.
544548
var flags = Task.JobFlags()
545549
flags.kind = .task

0 commit comments

Comments
 (0)