13
13
import Swift
14
14
@_implementationOnly import SwiftConcurrencyInternalShims
15
15
16
- // ==== Task.startSynchronously ------------------------------------------------
16
+ // ==== Task.immediate --------- ------------------------------------------------
17
17
18
18
% METHOD_VARIANTS = [
19
19
% 'THROWING',
@@ -56,11 +56,11 @@ extension Task where Failure == ${FAILURE_TYPE} {
56
56
/// - Returns: A reference to the unstructured task which may be awaited on.
57
57
@available(SwiftStdlib 6.2, *)
58
58
@discardableResult
59
- public static func startSynchronously (
59
+ public static func immediate (
60
60
name: String? = nil,
61
61
priority: TaskPriority? = nil,
62
62
% # NOTE: This closure cannot be 'sending' because we'll trigger ' pattern that the region based isolation checker does not understand how to check'
63
- % # In this case: `func syncOnMyGlobalActor() { Task.startSynchronously { @MyGlobalActor in } }`
63
+ % # In this case: `func syncOnMyGlobalActor() { Task.immediate { @MyGlobalActor in } }`
64
64
@_implicitSelfCapture _ operation: __owned @isolated(any) @escaping () async throws -> Success
65
65
) -> Task<Success, ${FAILURE_TYPE}> {
66
66
@@ -109,7 +109,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
109
109
}
110
110
111
111
if canRunSynchronously {
112
- _startTaskSynchronously (task!, targetExecutor: builtinSerialExecutor)
112
+ _startTaskImmediately (task!, targetExecutor: builtinSerialExecutor)
113
113
}
114
114
return Task<Success, ${FAILURE_TYPE}>(task!)
115
115
}
@@ -121,35 +121,35 @@ GROUP_AND_OP_INFO = [
121
121
(
122
122
'TaskGroup',
123
123
[
124
- 'startTaskSynchronously ',
125
- 'startTaskSynchronouslyUnlessCancelled '
124
+ 'addImmediateTask ',
125
+ 'addImmediateTaskUnlessCancelled '
126
126
],
127
127
'',
128
128
'ChildTaskResult'
129
129
),
130
130
(
131
131
'ThrowingTaskGroup',
132
132
[
133
- 'startTaskSynchronously ',
134
- 'startTaskSynchronouslyUnlessCancelled '
133
+ 'addImmediateTask ',
134
+ 'addImmediateTaskUnlessCancelled '
135
135
],
136
136
'throws ',
137
137
'ChildTaskResult'
138
138
),
139
139
(
140
140
'DiscardingTaskGroup',
141
141
[
142
- 'startTaskSynchronously ',
143
- 'startTaskSynchronouslyUnlessCancelled '
142
+ 'addImmediateTask ',
143
+ 'addImmediateTaskUnlessCancelled '
144
144
],
145
145
'',
146
146
'Void'
147
147
),
148
148
(
149
149
'ThrowingDiscardingTaskGroup',
150
150
[
151
- 'startTaskSynchronously ',
152
- 'startTaskSynchronouslyUnlessCancelled '
151
+ 'addImmediateTask ',
152
+ 'addImmediateTaskUnlessCancelled '
153
153
],
154
154
'throws ',
155
155
'Void'
@@ -204,7 +204,7 @@ extension ${GROUP_TYPE} {
204
204
taskGroup: self._group,
205
205
operation: operation
206
206
)
207
- _startTaskSynchronously (task, targetExecutor: builtinSerialExecutor)
207
+ _startTaskImmediately (task, targetExecutor: builtinSerialExecutor)
208
208
}
209
209
}
210
210
% end # METHOD_NAMES
@@ -264,5 +264,5 @@ extension Task where Failure == ${FAILURE_TYPE} {
264
264
@_silgen_name("swift_task_startOnMainActor")
265
265
internal func _startTaskOnMainActor(_ task: Builtin.NativeObject)
266
266
267
- @_silgen_name("swift_task_startSynchronously ")
268
- internal func _startTaskSynchronously (_ task: Builtin.NativeObject, targetExecutor: Builtin.Executor?)
267
+ @_silgen_name("swift_task_immediate ")
268
+ internal func _startTaskImmediately (_ task: Builtin.NativeObject, targetExecutor: Builtin.Executor?)
0 commit comments