You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// If no current `Task` is available, returns `Priority.default`.
89
-
///
90
-
/// - SeeAlso: `Task.Priority`
91
-
/// - SeeAlso: `Task.currentPriority`
92
-
@available(*, deprecated, message:"Storing `Task` instances has been deprecated, and as such instance functions on Task are deprecated and will be removed soon. Use the static 'Task.currentPriority' instead.")
93
-
publicvarpriority:Priority{
94
-
getJobFlags(_task).priority
60
+
returngetJobFlags(task._task).priority
61
+
}
95
62
}
96
63
97
64
/// Task priority may inform decisions an `Executor` makes about how and when
@@ -152,19 +119,22 @@ extension Task {
152
119
/// i.e. the task will run regardless of the handle still being present or not.
153
120
/// Dropping a handle however means losing the ability to await on the task's result
154
121
/// and losing the ability to cancel it.
122
+
///
123
+
// Implementation notes:
124
+
// A task handle can ONLY be obtained for a detached task, and as such shares
125
+
// no lifetime concerns with regards to holding and storing the `_task` with
126
+
// the `Task` type, which would have also be obtainable for any task, including
127
+
// a potentially task-local allocated one. I.e. it is always safe to store away
128
+
// a Task.Handle, yet the same is not true for the "current task" which may be
129
+
// a async-let created task, at risk of getting destroyed while the reference
0 commit comments