Skip to content
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

Revise Task docs for style #76560

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions stdlib/public/Concurrency/Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,32 +198,32 @@ extension Task {
///
/// Cancelling a task has three primary effects:
///
/// - It flags the task as cancelled.
/// - It causes any active cancellation handlers on the task to run (once).
/// - It flags the task as canceled.
/// - It causes any active cancellation handlers on the task to run, once.
/// - It cancels any child tasks and task groups of the task, including
/// those created in the future. If those tasks have cancellation handlers,
/// those created in the future. If those tasks have cancellation handlers,
/// they also are triggered.
///
/// Task cancellation is cooperative and idempotent.
///
/// Cancelling a task does not automatically cause arbitrary functions on the task
/// to stop running or throw errors. A function _may_ choose to react
/// to cancellation by ending its work early, and it is conventional to
/// signal that to callers by throwing CancellationError. However,
/// signal that to callers by throwing `CancellationError`. However,
/// a function that doesn't specifically check for cancellation will
/// run to completion normally even if the task it is running on is
/// cancelled. (Of course, it may still end early if it calls something
/// else that handles cancellation by throwing and then doesn't
/// handle the error.)
/// run to completion normally, even if the task it is running on is
/// canceled. However, that function might still end early if it calls
/// other code that handles cancellation by throwing and that function doesn't
/// handle the error.
///
/// It is safe to cancel a task from any task or thread. It is safe for
/// It's safe to cancel a task from any task or thread. It's safe for
/// multiple tasks or threads to cancel the same task at the same
/// time. Cancelling a task that has already been cancelled has no
/// time. Cancelling a task that has already been canceled has no
/// additional effect.
///
/// `cancel` may need to acquire locks and synchronously run
/// arbitrary cancellation-handler code associated with the
/// cancelled task. To reduce the risk of deadlock, it is
/// canceled task. To reduce the risk of deadlock, it is
/// recommended that callers release any locks they might be
/// holding before they call cancel.
///
Expand Down