You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: stdlib/public/Concurrency/Task.swift
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -22,34 +22,34 @@ import Swift
22
22
/// Tasks can start running immediately after creation;
23
23
/// you don't explicitly start or schedule them.
24
24
/// After creating a task, you use the instance to interact with it ---
25
-
/// for example, to wait for it to complete or to cancel in.
25
+
/// for example, to wait for it to complete or to cancel.
26
26
/// It's not a programming error to discard a reference to a task
27
27
/// without waiting for that task to finish or canceling it.
28
-
/// A task runs whetheror not you keep a reference to it.
28
+
/// A task runs regardless of whether<!-- EDIT: Don't use "whether or not". --> you keep a reference to it.
29
29
/// However, if you discard the reference to a task,
30
30
/// you give up the ability
31
-
/// to wait for that task's result or cancel the task.
31
+
/// to wait for that task's result or if it's canceled.
32
32
///
33
33
/// To support operations on the current task,
34
-
/// which can be either a detached task or a child task,
34
+
/// which can be either a detached task or child task,
35
35
/// `Task` also exposes class methods like `yield()`.
36
36
/// Because these methods are asynchronous,
37
37
/// they're always invoked as part of an existing task.
38
38
///
39
-
/// Only code that's running as part of the task can interact with that task,
39
+
/// Only code that's running as part of the task can interact with that task
40
40
/// by invoking the appropriate context-sensitive static functions which operate
41
-
/// on the current task.
41
+
/// on the current task.<!-- FIXME: Long sentence that could probably be split in two. -->
42
42
///
43
43
/// A task's execution can be seen as a series of periods where the task ran.
44
44
/// Each such period ends at a suspension point or the
45
45
/// completion of the task.
46
46
///
47
-
/// These partial periods towards the task's completion are `PartialAsyncTask`.
47
+
/// These partial periods towards<!-- FIXME: The preceding wording is a little awkward; please rewrite. --> the task's completion are `PartialAsyncTask`.
48
48
/// Unless you're implementing a scheduler,
49
-
/// you don't generally interact with partial tasks directly.
49
+
/// you don't directly interact with partial tasks.
50
50
///
51
51
/// For information about the language-level concurrency model that `Task` is part of,
52
-
/// see [Concurrency][concurrency] in *[The Swift Programming Language][tspl]*.
52
+
/// see [Concurrency][concurrency] in [The Swift Programming Language][tspl].
@@ -284,7 +284,7 @@ extension Task where Success == Never, Failure == Never {
284
284
/// this property's value is `Priority.default`.
285
285
publicstaticvarcurrentPriority:TaskPriority{
286
286
withUnsafeCurrentTask{ task in
287
-
// If we are running on behalf of a task, use that task's priority.
287
+
// If running on behalf of a task, use that task's priority.
288
288
iflet task = task {
289
289
return task.priority
290
290
}
@@ -307,7 +307,7 @@ extension TaskPriority {
307
307
308
308
/// Flags for schedulable jobs.
309
309
///
310
-
/// This is a port of the C++ FlagSet.
310
+
/// This is a port of the C++ FlagSet<!-- FIXME: Rewrite so you're not using FlagSet in the abstract. -->.
311
311
@available(SwiftStdlib 5.5,*)
312
312
structJobFlags{
313
313
/// Kinds of schedulable jobs.
@@ -329,7 +329,7 @@ struct JobFlags {
329
329
}
330
330
}
331
331
332
-
/// Whether this is an asynchronous task.
332
+
/// Whether this is an asynchronous task.<!-- FIXME: All of these "Whether" statements need to be rewritten to be clearer. What does "Whether" tie into? That part of these one-line descriptions doesn't work. Fix here and throughout the remainder of these for this section. Also, should the lines terminate with a colon instead of a period? -->
/// Form task creation flags for use with the createAsyncTask builtins.
417
+
/// Form task creation flags for use with the `createAsyncTask`<!-- FIXME: If this is an abstract, you'll need to rewrite so you're not including createAsyncTask here. --> built-ins<!-- FIXME: Hyphenate. -->.
418
418
@available(SwiftStdlib 5.5,*)
419
419
@_alwaysEmitIntoClient
420
420
func taskCreateFlags(
@@ -546,7 +546,7 @@ extension Task where Failure == Never {
546
546
/// Runs the given nonthrowing operation asynchronously
547
547
/// as part of a new top-level task.
548
548
///
549
-
/// Avoid using a detached task unless it isn't possible
549
+
/// Don't use a detached task unless it isn't possible
550
550
/// to model the operation using structured concurrency features like child tasks.
551
551
/// Child tasks inherit the parent task's priority and task-local storage,
552
552
/// and canceling a parent task automatically cancels all of its child tasks.
@@ -44,7 +44,7 @@ public func withTaskCancellationHandler<T>(
44
44
45
45
@available(SwiftStdlib 5.5,*)
46
46
extensionTask{
47
-
/// Returns `true`if the task is canceled, and should stop executing.
47
+
/// Returns `true`<!-- FIXME: If this is an abstract, don't include code font or links. --> if the task is canceled<!-- FIXME: Passive; rewrite. -->, and should stop executing.
/// Returns `true` if the task is canceled, and should stop executing.
63
+
/// Returns `true` if the task is canceled, and should stop executing.<!-- FIXME: Abstracts need to be unique; this is copy/pasted from what's on line 47, which means it carries the same problems. Rewrite the abstract so that this is different from the one on line 47. What sets it apart? Why would someone use this over the previous? -->
64
64
///
65
65
/// If no current `Task` is available, returns `false`, as outside of a task
66
-
/// context no task cancellation may be observed.
66
+
/// context no task cancellation may be observed<!-- FIXME: Passive; rewrite. -->.
67
67
///
68
68
/// - SeeAlso: `checkCancellation()`
69
69
publicstaticvarisCancelled:Bool{
@@ -75,7 +75,7 @@ extension Task where Success == Never, Failure == Never {
/// Check if the task is canceledand throw an `CancellationError` if it was.
78
+
/// Check if the task is canceled<!-- FIXME: Passive; rewrite. --> and throw an `CancellationError`<!-- FIXME: Don't include symbols in abstracts. --> if it was.
79
79
///
80
80
/// The error is always an instance of `Task.CancellationError`.
81
81
///
@@ -87,13 +87,13 @@ extension Task where Success == Never, Failure == Never {
87
87
}
88
88
}
89
89
90
-
/// The default cancellation thrown when a task is canceled.
90
+
/// The default cancellation thrown when a task is canceled<!-- FIXME: Passive; rewrite. -->.
91
91
///
92
92
/// This error is also thrown automatically by `Task.checkCancellation()`,
93
-
/// if the current task has been canceled.
93
+
/// if the current task has been canceled<!-- FIXME: Passive; rewrite. -->.
94
94
@available(SwiftStdlib 5.5,*)
95
95
publicstructCancellationError:Error{
96
-
// no extra information, cancellation is intended to be light-weight
96
+
// No extra information; cancellation is intended to be light-weight.
0 commit comments