Skip to content

Clean up doc comments for task APIs. #38815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 25, 2021
Merged
4 changes: 2 additions & 2 deletions stdlib/public/Concurrency/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

import Swift

/// A service which can execute jobs.
/// A service that can execute jobs.
@available(SwiftStdlib 5.5, *)
public protocol Executor: AnyObject, Sendable {
func enqueue(_ job: UnownedJob)
}

/// A service which can execute jobs.
/// A service that executes jobs.
@available(SwiftStdlib 5.5, *)
public protocol SerialExecutor: Executor {
// This requirement is repeated here as a non-override so that we
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/Concurrency/GlobalActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import Swift
/// A type that represents a globally-unique actor that can be used to isolate
/// various declarations anywhere in the program.
///
/// A type that conforms to the `GlobalActor` protocol and is marked with the
/// A type that conforms to the `GlobalActor` protocol and is marked with
/// the `@globalActor` attribute can be used as a custom attribute. Such types
/// are called global actor types, and can be applied to any declaration to
/// specify that such types are isolated to that global actor type. When using
/// such a declaration from another actor (or from nonisolated code),
/// synchronization is performed through the \c shared actor instance to ensure
/// synchronization is performed through the shared actor instance to ensure
/// mutually-exclusive access to the declaration.
@available(SwiftStdlib 5.5, *)
public protocol GlobalActor {
Expand Down
366 changes: 189 additions & 177 deletions stdlib/public/Concurrency/Task.swift

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions stdlib/public/Concurrency/TaskCancellation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public func withTaskCancellationHandler<T>(

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

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

@available(SwiftStdlib 5.5, *)
extension Task where Success == Never, Failure == Never {
/// Check if the task is cancelled and throw an `CancellationError` if it was.
/// Throws an error if the task was canceled.
///
/// The error is always an instance of `Task.CancellationError`.
///
Expand All @@ -87,10 +90,10 @@ extension Task where Success == Never, Failure == Never {
}
}

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