Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/swift/Runtime/DispatchShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ swift_dispatch_thread_override_self(qos_class_t override_qos) {
static inline uint32_t
swift_dispatch_thread_override_self_with_base(qos_class_t override_qos, qos_class_t base_qos) {

if (__builtin_available(macOS 27.0, iOS 27.0, tvOS 27.0, watchOS 27.0, *)) {
if (__builtin_available(macOS 9998, iOS 9998, tvOS 9998, watchOS 9998, *)) {
return dispatch_thread_override_self_with_base(override_qos, base_qos);
} else if (__builtin_available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)) {
} else if (__builtin_available(macOS 9998, iOS 9998, tvOS 9998, watchOS 9998, *)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktoso why has this been changed? Shouldn't this stay with macOS 13 etc.?
Otherwise this doesn't make a lot of sense as this is already covered by the condition above.

// If we don't have the ability to set our base qos correctly, at least set the override
// We want to return 0 here because we have nothing to reset in this case
(void) dispatch_thread_override_self(override_qos);
Expand All @@ -64,7 +64,7 @@ swift_dispatch_thread_override_self_with_base(qos_class_t override_qos, qos_clas

static inline void
swift_dispatch_thread_reset_override_self(uint32_t opaque) {
if (__builtin_available(macOS 27.0, iOS 27.0, tvOS 27.0, watchOS 27.0, *)) {
if (__builtin_available(macOS 9998, iOS 9998, tvOS 9998, watchOS 9998, *)) {
dispatch_thread_reset_override_self(opaque);
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/Concurrency/async_task_priority.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,15 @@ actor Test {
await task2.value // Escalate task2 which should be queued behind task1 on the actor
}

// This test will only work properly on 27.0+
if #available(macOS 27.0, iOS 27.0, tvOS 27.0, watchOS 27.0, *) {
// This test will only work properly if Dispatch supports lowering the base priority of a thread
if #available(macOS 9998, iOS 9998, tvOS 9998, watchOS 9998, *) {
tests.test("Task escalation doesn't impact qos_class_self") {
let task = Task(priority: .utility) {
let initialQos = DispatchQoS(
qosClass: DispatchQoS.QoSClass(rawValue: qos_class_self())!,
relativePriority: 0)
expectEqual(initialQos, DispatchQoS.utility)
let childTask = Task {
let innerTask = Task {
let qosBeforeEscalate = DispatchQoS(
qosClass: DispatchQoS.QoSClass(rawValue: qos_class_self())!,
relativePriority: 0)
Expand All @@ -353,7 +353,7 @@ actor Test {
expectEqual(qosAfterYield, DispatchQoS.utility)
}

await childTask.value
await innerTask.value
}

await task.value
Expand Down