@@ -38,9 +38,9 @@ extension Task where Failure == ${FAILURE_TYPE} {
38
38
public static func startSynchronously(
39
39
name: String? = nil,
40
40
priority: TaskPriority? = nil,
41
- @_implicitSelfCapture _ operation: __owned @isolated(any) @escaping () async throws -> Success
41
+ @_implicitSelfCapture @_inheritActorContext(always) _ operation: sending @isolated(any) @escaping () async throws -> Success
42
42
) -> Task<Success, ${FAILURE_TYPE}> {
43
- immediate(name: name, priority: priority, operation)
43
+ immediate(name: name, priority: priority, operation: operation )
44
44
}
45
45
46
46
/// Create and immediately start running a new task in the context of the calling thread/task.
@@ -66,13 +66,14 @@ extension Task where Failure == ${FAILURE_TYPE} {
66
66
/// - operation: the operation to be run immediately upon entering the task.
67
67
/// - Returns: A reference to the unstructured task which may be awaited on.
68
68
@available(SwiftStdlib 6.2, *)
69
+ @_alwaysEmitIntoClient
69
70
@discardableResult
70
71
public static func immediate(
71
72
name: String? = nil,
72
73
priority: TaskPriority? = nil,
73
74
% # NOTE: This closure cannot be 'sending' because we'll trigger ' pattern that the region based isolation checker does not understand how to check'
74
75
% # In this case: `func syncOnMyGlobalActor() { Task.immediate { @MyGlobalActor in } }`
75
- @_implicitSelfCapture _ operation: __owned @isolated(any) @escaping () async throws -> Success
76
+ @_implicitSelfCapture @_inheritActorContext(always) operation: sending @isolated(any) @escaping () async throws -> Success
76
77
) -> Task<Success, ${FAILURE_TYPE}> {
77
78
78
79
let builtinSerialExecutor =
@@ -188,6 +189,7 @@ extension ${GROUP_TYPE} {
188
189
/// is semantically equivalent to its basic version which can be
189
190
/// created using ``${GROUP_TYPE}/addTask``.
190
191
@available(SwiftStdlib 6.2, *)
192
+ @_alwaysEmitIntoClient
191
193
public func ${METHOD_NAME}( // in ${GROUP_TYPE}
192
194
name: String? = nil,
193
195
priority: TaskPriority? = nil,
@@ -275,5 +277,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
275
277
@_silgen_name("swift_task_startOnMainActor")
276
278
internal func _startTaskOnMainActor(_ task: Builtin.NativeObject)
277
279
280
+ @available(SwiftStdlib 6.2, *)
278
281
@_silgen_name("swift_task_immediate")
282
+ @usableFromInline
279
283
internal func _startTaskImmediately(_ task: Builtin.NativeObject, targetExecutor: Builtin.Executor?)
0 commit comments