Skip to content

Commit 4bdf869

Browse files
committed
Clean up doc comments for task APIs.
Cherry pick #38815, b9dde85.
1 parent a85e729 commit 4bdf869

File tree

8 files changed

+402
-363
lines changed

8 files changed

+402
-363
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
import Swift
1414

15-
/// A service which can execute jobs.
15+
/// A service that can execute jobs.
1616
@available(SwiftStdlib 5.5, *)
1717
public protocol Executor: AnyObject, Sendable {
1818
func enqueue(_ job: UnownedJob)
1919
}
2020

21-
/// A service which can execute jobs.
21+
/// A service that executes jobs.
2222
@available(SwiftStdlib 5.5, *)
2323
public protocol SerialExecutor: Executor {
2424
// This requirement is repeated here as a non-override so that we

stdlib/public/Concurrency/GlobalActor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import Swift
1515
/// A type that represents a globally-unique actor that can be used to isolate
1616
/// various declarations anywhere in the program.
1717
///
18-
/// A type that conforms to the `GlobalActor` protocol and is marked with the
18+
/// A type that conforms to the `GlobalActor` protocol and is marked with
1919
/// the `@globalActor` attribute can be used as a custom attribute. Such types
2020
/// are called global actor types, and can be applied to any declaration to
2121
/// specify that such types are isolated to that global actor type. When using
2222
/// such a declaration from another actor (or from nonisolated code),
23-
/// synchronization is performed through the \c shared actor instance to ensure
23+
/// synchronization is performed through the shared actor instance to ensure
2424
/// mutually-exclusive access to the declaration.
2525
@available(SwiftStdlib 5.5, *)
2626
public protocol GlobalActor {

stdlib/public/Concurrency/Task.swift

Lines changed: 189 additions & 177 deletions
Large diffs are not rendered by default.

stdlib/public/Concurrency/TaskCancellation.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public func withTaskCancellationHandler<T>(
4444

4545
@available(SwiftStdlib 5.5, *)
4646
extension Task {
47-
/// Returns `true` if the task is cancelled, and should stop executing.
47+
/// A Boolean value that indicates whether the task should stop executing.
48+
///
49+
/// After the value of this property becomes `true`, it remains `true` indefinitely.
50+
/// There is no way to uncancel a task.
4851
///
4952
/// - SeeAlso: `checkCancellation()`
5053
public var isCancelled: Bool {
@@ -60,10 +63,10 @@ extension Task {
6063

6164
@available(SwiftStdlib 5.5, *)
6265
extension Task where Success == Never, Failure == Never {
63-
/// Returns `true` if the task is cancelled, and should stop executing.
66+
/// A Boolean value that indicates whether the task should stop executing.
6467
///
65-
/// If no current `Task` is available, returns `false`, as outside of a task
66-
/// context no task cancellation may be observed.
68+
/// After the value of this property becomes `true`, it remains `true` indefinitely.
69+
/// There is no way to uncancel a task.
6770
///
6871
/// - SeeAlso: `checkCancellation()`
6972
public static var isCancelled: Bool {
@@ -75,7 +78,7 @@ extension Task where Success == Never, Failure == Never {
7578

7679
@available(SwiftStdlib 5.5, *)
7780
extension Task where Success == Never, Failure == Never {
78-
/// Check if the task is cancelled and throw an `CancellationError` if it was.
81+
/// Throws an error if the task was canceled.
7982
///
8083
/// The error is always an instance of `Task.CancellationError`.
8184
///
@@ -87,10 +90,10 @@ extension Task where Success == Never, Failure == Never {
8790
}
8891
}
8992

90-
/// The default cancellation thrown when a task is cancelled.
93+
/// An error that indicates a task was canceled.
9194
///
9295
/// This error is also thrown automatically by `Task.checkCancellation()`,
93-
/// if the current task has been cancelled.
96+
/// if the current task has been canceled.
9497
@available(SwiftStdlib 5.5, *)
9598
public struct CancellationError: Error {
9699
// no extra information, cancellation is intended to be light-weight

0 commit comments

Comments
 (0)