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
1414
1515@available ( SwiftStdlib 5 . 5 , * )
1616extension 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:) " )
2118 public static func sleep( _ duration: UInt64 ) async {
2219 return await Builtin . withUnsafeContinuation { ( continuation: Builtin . RawUnsafeContinuation ) -> Void in
2320 let job = _taskCreateNullaryContinuationJob (
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ func asyncThrowsOnCancel() async throws -> Int {
1313 // terrible suspend-spin-loop -- do not do this
1414 // only for purposes of demonstration
1515 while Task . isCancelled {
16- await Task . sleep ( 1_000_000_000 )
16+ try ? await Task . sleep ( nanoseconds : 1_000_000_000 )
1717 }
1818
1919 throw CancellationError ( )
You can’t perform that action at this time.
0 commit comments