Skip to content

Commit 27d734a

Browse files
committed
[Concurrency] Include Task.sleep(until:) and Task.yield() placeholders
1 parent 9e8f2cc commit 27d734a

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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

217242
extension Task {

stdlib/public/Concurrency/TaskCancellation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)