File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,7 @@ import Swift
14
14
15
15
@available ( SwiftStdlib 5 . 5 , * )
16
16
extension Task where Success == Never , Failure == Never {
17
- /// Suspends the current task for _at least_ the given duration
18
- /// in nanoseconds.
19
- ///
20
- /// This function does _not_ block the underlying thread.
17
+ @available ( * , deprecated, renamed: " Task.sleep(nanoseconds:) " )
21
18
public static func sleep( _ duration: UInt64 ) async {
22
19
return await Builtin . withUnsafeContinuation { ( continuation: Builtin . RawUnsafeContinuation ) -> Void in
23
20
let job = _taskCreateNullaryContinuationJob (
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ func asyncThrowsOnCancel() async throws -> Int {
13
13
// terrible suspend-spin-loop -- do not do this
14
14
// only for purposes of demonstration
15
15
while Task . isCancelled {
16
- await Task . sleep ( 1_000_000_000 )
16
+ try ? await Task . sleep ( nanoseconds : 1_000_000_000 )
17
17
}
18
18
19
19
throw CancellationError ( )
You can’t perform that action at this time.
0 commit comments