Skip to content

Commit bfd4ef6

Browse files
authored
Merge pull request #2090 from ahoppen/prioritychangedhandler
Fix theoretical issue in `withTaskPriorityChangedHandler` that could always report a priority change to `high`
2 parents 374554b + 250081e commit bfd4ef6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Sources/SwiftExtensions/Task+WithPriorityChangedHandler.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ package func withTaskPriorityChangedHandler<T: Sendable>(
2929
// want to make sure that we don't leave the body task or the priority watching task running.
3030
taskGroup.cancelAll()
3131
}
32-
// Run the task priority watcher with high priority instead of inheriting the initial priority. Otherwise a
33-
// `.background` task might not get its priority elevated because the priority watching task also runs at
34-
// `.background` priority and might not actually get executed in time.
35-
taskGroup.addTask(priority: .high) {
32+
taskGroup.addTask(priority: initialPriority) {
3633
while true {
3734
if Task.isCancelled {
3835
break

0 commit comments

Comments
 (0)