#SwiftLang #SwiftUI #concurrency task priority inversion question.
A SwiftUI view has a .task(id: ) modifier.
The task, among other things, calls an async func
.task(id: item) {
// ...
if let item {
value = await item.someFunction()
}
// ...
}
someFunction() calls someOtherFunction() [not async] and
someOtherFunction() eventually does this:
if let imgPreview = CGImageSourceCreateThumbnailAtIndex(...) { ... }
At runtime in Xcode I see this notice on the above line.
[Internal] Thread running at User-initiated quality-of-service
class waiting on a lower QoS thread running at Default
quality-of-service class. Investigate ways to avoid
priority inversions
Does not item.someFunction() get the same priority as the
task? Where does the lower QoS thread come from?
And how can I learn more about it. And fix it?