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
@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.")
139
-
publicvarpriority:Priority{
140
-
getJobFlags(_task).priority ??.default
141
-
}
142
-
143
92
/// The priority of a task.
144
93
///
145
94
/// The executor determines how priority information affects the way tasks are scheduled.
@@ -208,23 +157,26 @@ extension Task {
208
157
///
209
158
/// You can use a task's handle to wait for its result or cancel the task.
210
159
///
211
-
/// It isn't a programming error to discard a task's handle without awaiting or canceling the task.
212
-
/// A task runs regardless of whether you still have its handle stored somewhere.
213
-
/// However, if you discard a task's handle, you give up the ability
214
-
/// to wait for that task's result or cancel the task.
160
+
/// It is not a programming error to drop a handle without awaiting or cancelling it,
161
+
/// i.e. the task will run regardless of the handle still being present or not.
162
+
/// Dropping a handle however means losing the ability to await on the task's result
163
+
/// and losing the ability to cancel it.
164
+
///
165
+
// Implementation notes:
166
+
// A task handle can ONLY be obtained for a detached task, and as such shares
167
+
// no lifetime concerns with regards to holding and storing the `_task` with
168
+
// the `Task` type, which would have also be obtainable for any task, including
169
+
// a potentially task-local allocated one. I.e. it is always safe to store away
170
+
// a Task.Handle, yet the same is not true for the "current task" which may be
171
+
// a async-let created task, at risk of getting destroyed while the reference
0 commit comments