Skip to content

Commit 65b3c07

Browse files
committed
[concurrency] Add UnownedJob._runSynchronously(on:) to support running a job synchronously on an executor.
I am going to use this to test that we propagate synchronous accesses into asynchronous tasks access sets. To ensure this is not ABI, I underscored/marked this as alwaysEmitIntoClient. (cherry picked from commit fc4d6c8)
1 parent 4b96536 commit 65b3c07

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
import Swift
1414
@_implementationOnly import _SwiftConcurrencyShims
1515

16+
@available(SwiftStdlib 5.5, *)
17+
@_silgen_name("swift_job_run")
18+
@usableFromInline
19+
internal func _swiftJobRun(_ job: UnownedJob,
20+
_ executor: UnownedSerialExecutor) -> ()
21+
1622
/// A unit of scheduleable work.
1723
///
1824
/// Unless you're implementing a scheduler,
@@ -21,6 +27,12 @@ import Swift
2127
@frozen
2228
public struct UnownedJob {
2329
private var context: Builtin.Job
30+
31+
@_alwaysEmitIntoClient
32+
@inlinable
33+
public func _runSynchronously(on executor: UnownedSerialExecutor) {
34+
_swiftJobRun(self, executor)
35+
}
2436
}
2537

2638
/// A mechanism to interface

0 commit comments

Comments
 (0)