Skip to content

Commit 8b2253c

Browse files
committed
[Concurrency] Fix continuation documentation about execution semantics
1 parent 78749d8 commit 8b2253c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

stdlib/public/Concurrency/CheckedContinuation.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ extension CheckedContinuation {
252252
}
253253
}
254254

255-
/// Suspends the current task,
256-
/// then calls the given closure with a checked continuation for the current task.
255+
/// Invokes the passed in closure and provides with a checked continuation for the current task.
256+
/// The body of the closure executes synchronously on the calling task, and once it returns
257+
/// the calling task is suspended. It is possible to immediately resume the task, or escape the
258+
/// continuation in order to complete it afterwards, and thus resuming the suspended task.
257259
///
258260
/// - Parameters:
259261
/// - function: A string identifying the declaration that is the notional
@@ -273,8 +275,10 @@ public func withCheckedContinuation<T>(
273275
}
274276
}
275277

276-
/// Suspends the current task,
277-
/// then calls the given closure with a checked throwing continuation for the current task.
278+
/// Invokes the passed in closure and provides with a checked throwing continuation for the current task.
279+
/// The body of the closure executes synchronously on the calling task, and once it returns
280+
/// the calling task is suspended. It is possible to immediately resume the task, or escape the
281+
/// continuation in order to complete it afterwards, and thus resuming the suspended task.
278282
///
279283
/// - Parameters:
280284
/// - function: A string identifying the declaration that is the notional

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,10 @@ internal func _resumeUnsafeThrowingContinuationWithError<T>(
293293

294294
#endif
295295

296-
/// Suspends the current task,
297-
/// then calls the given closure with an unsafe continuation for the current task.
296+
/// Invokes the passed in closure and provides with an unsafe continuation for the current task.
297+
/// The body of the closure executes synchronously on the calling task, and once it returns
298+
/// the calling task is suspended. It is possible to immediately resume the task, or escape the
299+
/// continuation in order to complete it afterwards, and thus resuming the suspended task.
298300
///
299301
/// - Parameter fn: A closure that takes an `UnsafeContinuation` parameter.
300302
/// You must resume the continuation exactly once.
@@ -311,8 +313,10 @@ public func withUnsafeContinuation<T>(
311313
}
312314
}
313315

314-
/// Suspends the current task,
315-
/// then calls the given closure with an unsafe throwing continuation for the current task.
316+
/// Invokes the passed in closure and provides with a unsafe throwing continuation for the current task.
317+
/// The body of the closure executes synchronously on the calling task, and once it returns
318+
/// the calling task is suspended. It is possible to immediately resume the task, or escape the
319+
/// continuation in order to complete it afterwards, and thus resuming the suspended task.
316320
///
317321
/// - Parameter fn: A closure that takes an `UnsafeContinuation` parameter.
318322
/// You must resume the continuation exactly once.

0 commit comments

Comments
 (0)