@@ -306,10 +306,10 @@ extension Task where Success == Never, Failure == Never {
306
306
/// If the system can't provide a priority,
307
307
/// this property's value is `Priority.default`.
308
308
public static var currentPriority : TaskPriority {
309
- withUnsafeCurrentTask { task in
309
+ withUnsafeCurrentTask { unsafeTask in
310
310
// If we are running on behalf of a task, use that task's priority.
311
- if let unsafeTask = task {
312
- return TaskPriority ( rawValue : _taskCurrentPriority ( unsafeTask. _task ) )
311
+ if let unsafeTask {
312
+ return unsafeTask. priority
313
313
}
314
314
315
315
// Otherwise, query the system.
@@ -330,6 +330,7 @@ extension Task where Success == Never, Failure == Never {
330
330
return nil
331
331
}
332
332
}
333
+
333
334
}
334
335
335
336
@available ( SwiftStdlib 5 . 1 , * )
@@ -839,6 +840,15 @@ public struct UnsafeCurrentTask {
839
840
TaskPriority ( rawValue: _taskCurrentPriority ( _task) )
840
841
}
841
842
843
+ /// The current task's base priority.
844
+ ///
845
+ /// - SeeAlso: `TaskPriority`
846
+ /// - SeeAlso: `Task.currentBasePriority`
847
+ @available ( SwiftStdlib 5 . 9 , * )
848
+ public var basePriority : TaskPriority {
849
+ TaskPriority ( rawValue: _taskBasePriority ( _task) )
850
+ }
851
+
842
852
/// Cancel the current task.
843
853
public func cancel( ) {
844
854
_taskCancel ( _task)
0 commit comments