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
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -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 running on behalf of a task, use that task's priority.
287
+
// If we are 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<!-- FIXME: Rewrite so you're not using FlagSet in the abstract. -->.
310
+
/// This is a port of the C++ FlagSet.
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.<!-- 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`<!-- FIXME: If this is an abstract, you'll need to rewrite so you're not including createAsyncTask here. --> built-ins<!-- FIXME: Hyphenate. -->.
417
+
/// Form task creation flags for use with the createAsyncTask builtins.
418
418
@available(SwiftStdlib 5.5,*)
419
419
@_alwaysEmitIntoClient
420
420
func taskCreateFlags(
@@ -878,8 +878,8 @@ func _getCurrentThreadPriority() -> Int
878
878
879
879
#if _runtime(_ObjC)
880
880
881
-
/// Intrinsic used by SILGen<!-- FIXME: Should this be in code font? --> to launch a task for bridging a Swift async method
882
-
/// which was called through its ObjC<!-- FIXME: Should this be in code font? -->-exported completion-handler–based API.
881
+
/// Intrinsic used by SILGen to launch a task for bridging a Swift async method
882
+
/// which was called through its ObjC-exported completion-handler-based API.
// The group is canceled and isn't accepting any new work.
525
+
// the group is cancelled and is not accepting any new work
526
526
returnfalse
527
527
}
528
528
@@ -645,7 +645,7 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
645
645
646
646
return.success(success)
647
647
}catch{
648
-
return.failure(error as!Failure) // as!-safe, because we<!-- FIXME: Correct the use of first-person voice here and throughout. --> are only allowed to throw Failure (Error).
648
+
return.failure(error as!Failure) // as!-safe, because weare only allowed to throw Failure (Error)
/// Encode the sleep state into a word of storage.
83
+
/// Encode sleep state into a word of storage.
84
84
varword:UInt{
85
85
switchself{
86
86
case.notStarted:
@@ -102,8 +102,8 @@ extension Task where Success == Never, Failure == Never {
102
102
}
103
103
}
104
104
105
-
/// Called when the sleep(nanoseconds:)<!-- FIXME: If this is an abstract, remove the symbol and use an English language equivalent. --> operation woke up without being
106
-
/// canceled<!-- FIXME: Passive; rewrite. -->.
105
+
/// Called when the sleep(nanoseconds:) operation woke up without being
106
+
/// canceled.
107
107
privatestaticfunc onSleepWake(
108
108
_ wordPtr:UnsafeMutablePointer<Builtin.Word>
109
109
){
@@ -114,39 +114,39 @@ extension Task where Success == Never, Failure == Never {
114
114
fatalError("Cannot wake before we even started")
115
115
116
116
case.activeContinuation(let continuation):
117
-
// We<!-- FIXME: Correct the use of first person voice here and throughout. Comments, even those that don't get published, should follow Apple Style. --> have an active continuation, so try to transition to the
117
+
// We have an active continuation, so try to transition to the
118
118
// "finished" state.
119
119
let(_, won)=Builtin.cmpxchg_seqcst_seqcst_Word(
120
120
wordPtr._rawValue,
121
121
state.word._builtinWordValue,
122
122
SleepState.finished.word._builtinWordValue)
123
123
ifBool(_builtinBooleanLiteral: won){
124
-
// The sleep finished, so invoke the continuation: we're<!-- FIXME: Fix voice. --> done.
124
+
// The sleep finished, so invoke the continuation: we're done.
125
125
continuation.resume()
126
126
return
127
127
}
128
128
129
-
// Try again.
129
+
// Try again!
130
130
continue
131
131
132
132
case.finished:
133
-
fatalError("Already finished normally, can't do that again.")
133
+
fatalError("Already finished normally, can't do that again")
134
134
135
135
case.cancelled:
136
-
// The task was canceled, which means the continuation was
137
-
// called by the cancellation handler. We<!-- FIXME: Fix voice. --> need to deallocate the flag
136
+
// The task was cancelled, which means the continuation was
137
+
// called by the cancellation handler. We need to deallocate the flag
138
138
// word, because it was left over for this task to complete.
139
139
wordPtr.deallocate()
140
140
return
141
141
142
142
case.cancelledBeforeStarted:
143
-
// Nothing to do.
143
+
// Nothing to do;
144
144
return
145
145
}
146
146
}
147
147
}
148
148
149
-
/// Called when the sleep(nanoseconds:)<!-- FIXME: If this is an abstract, remove the symbol and use an English language equivalent. --> operation has been canceled<!-- FIXME: Passive; rewrite. --> before
149
+
/// Called when the sleep(nanoseconds:)operation has been canceled before
150
150
/// the sleep completed.
151
151
privatestaticfunc onSleepCancel(
152
152
_ wordPtr:UnsafeMutablePointer<Builtin.Word>
@@ -155,7 +155,7 @@ extension Task where Success == Never, Failure == Never {
155
155
letstate=SleepState(loading: wordPtr)
156
156
switch state {
157
157
case.notStarted:
158
-
// We<!-- FIXME: Fix voice. --> haven't started yet, so try to transition to the cancelled-before
158
+
// We haven't started yet, so try to transition to the cancelled-before
159
159
// started state.
160
160
let(_, won)=Builtin.cmpxchg_seqcst_seqcst_Word(
161
161
wordPtr._rawValue,
@@ -165,24 +165,24 @@ extension Task where Success == Never, Failure == Never {
165
165
return
166
166
}
167
167
168
-
// Try again.
168
+
// Try again!
169
169
continue
170
170
171
171
case.activeContinuation(let continuation):
172
-
// We<!-- FIXME: Fix voice. --> have an active continuation, so try to transition to the
172
+
// We have an active continuation, so try to transition to the
173
173
// "cancelled" state.
174
174
let(_, won)=Builtin.cmpxchg_seqcst_seqcst_Word(
175
175
wordPtr._rawValue,
176
176
state.word._builtinWordValue,
177
177
SleepState.cancelled.word._builtinWordValue)
178
178
ifBool(_builtinBooleanLiteral: won){
179
-
// We<!-- FIXME: Fix voice. --> recorded the task cancellation before the sleep finished, so
179
+
// We recorded the task cancellation before the sleep finished, so
180
180
// invoke the continuation with the cancellation error.
0 commit comments