File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,31 @@ extension Task {
212212 }
213213}
214214
215+ // ==== Voluntary Suspension -----------------------------------------------------
216+ extension Task {
217+
218+ /// Suspend until a given point in time.
219+ ///
220+ /// ### Cancellation
221+ /// Does not check for cancellation and suspends the current context until the
222+ /// given deadline.
223+ ///
224+ /// - Parameter until: point in time until which to suspend.
225+ public static func sleep( until: Deadline ) async {
226+ fatalError ( " \( #function) not implemented yet. " )
227+ }
228+
229+ /// Explicitly suspend the current task, potentially giving up execution actor
230+ /// of current actor/task, allowing other tasks to execute.
231+ ///
232+ /// This is not a perfect cure for starvation;
233+ /// if the task is the highest-priority task in the system, it might go
234+ /// immediately back to executing.
235+ public static func yield( ) async {
236+ fatalError ( " \( #function) not implemented yet. " )
237+ }
238+ }
239+
215240// ==== UnsafeContinuation -----------------------------------------------------
216241
217242extension Task {
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ extension Task {
171171 }
172172
173173 public static var distantFuture : Self {
174- . init( time : . max)
174+ . init( at : . max)
175175 }
176176
177177 public static func `in`( _ interval: _TimeInterval ) -> Self {
You can’t perform that action at this time.
0 commit comments