Skip to content

Commit 7ab63eb

Browse files
authored
Merge pull request #72292 from hborla/task-executor-availability
[Concurrency] Task executors are available in Swift 6.0.
2 parents 2ebae40 + 5d9ad87 commit 7ab63eb

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public protocol SerialExecutor: Executor {
120120
///
121121
/// Unstructured tasks do not inherit the task executor.
122122
@_unavailableInEmbedded
123-
@available(SwiftStdlib 9999, *)
123+
@available(SwiftStdlib 6.0, *)
124124
public protocol TaskExecutor: Executor {
125125
// This requirement is repeated here as a non-override so that we
126126
// get a redundant witness-table entry for it. This allows us to
@@ -152,7 +152,7 @@ public protocol TaskExecutor: Executor {
152152
}
153153

154154
@_unavailableInEmbedded
155-
@available(SwiftStdlib 9999, *)
155+
@available(SwiftStdlib 6.0, *)
156156
extension TaskExecutor {
157157
public func asUnownedTaskExecutor() -> UnownedTaskExecutor {
158158
UnownedTaskExecutor(ordinary: self)
@@ -270,7 +270,7 @@ public struct UnownedSerialExecutor: Sendable {
270270

271271

272272
@_unavailableInEmbedded
273-
@available(SwiftStdlib 9999, *)
273+
@available(SwiftStdlib 6.0, *)
274274
@frozen
275275
public struct UnownedTaskExecutor: Sendable {
276276
#if $BuiltinExecutor
@@ -279,7 +279,7 @@ public struct UnownedTaskExecutor: Sendable {
279279

280280
/// SPI: Do not use. Cannot be marked @_spi, since we need to use it from Distributed module
281281
/// which needs to reach for this from an @_transparent function which prevents @_spi use.
282-
@available(SwiftStdlib 9999, *)
282+
@available(SwiftStdlib 6.0, *)
283283
public var _executor: Builtin.Executor {
284284
self.executor
285285
}
@@ -303,7 +303,7 @@ public struct UnownedTaskExecutor: Sendable {
303303
}
304304

305305
@_unavailableInEmbedded
306-
@available(SwiftStdlib 9999, *)
306+
@available(SwiftStdlib 6.0, *)
307307
extension UnownedTaskExecutor: Equatable {
308308
@inlinable
309309
public static func == (_ lhs: UnownedTaskExecutor, _ rhs: UnownedTaskExecutor) -> Bool {
@@ -373,7 +373,7 @@ internal func _task_serialExecutor_getExecutorRef<E>(_ executor: E) -> Builtin.E
373373
/// Obtain the executor ref by calling the executor's `asUnownedTaskExecutor()`.
374374
/// The obtained executor ref will have all the user-defined flags set on the executor.
375375
@_unavailableInEmbedded
376-
@available(SwiftStdlib 9999, *)
376+
@available(SwiftStdlib 6.0, *)
377377
@_silgen_name("_task_executor_getTaskExecutorRef")
378378
internal func _task_executor_getTaskExecutorRef(_ taskExecutor: any TaskExecutor) -> Builtin.Executor {
379379
return taskExecutor.asUnownedTaskExecutor().executor
@@ -396,7 +396,7 @@ where E: SerialExecutor {
396396
}
397397

398398
@_unavailableInEmbedded
399-
@available(SwiftStdlib 9999, *)
399+
@available(SwiftStdlib 6.0, *)
400400
@_silgen_name("_swift_task_enqueueOnTaskExecutor")
401401
internal func _enqueueOnTaskExecutor<E>(job unownedJob: UnownedJob, executor: E) where E: TaskExecutor {
402402
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

stdlib/public/Concurrency/GlobalConcurrentExecutor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Swift
3131
/// detailed discussion of task executor preferences.
3232
///
3333
/// Customizing the global concurrent executor is currently not supported.
34-
@available(SwiftStdlib 9999, *)
34+
@available(SwiftStdlib 6.0, *)
3535
public var globalConcurrentExecutor: any TaskExecutor {
3636
get {
3737
_DefaultGlobalConcurrentExecutor.shared
@@ -43,7 +43,7 @@ public var globalConcurrentExecutor: any TaskExecutor {
4343
/// A task executor which enqueues all work on the default global concurrent
4444
/// thread pool that is used as the default executor for Swift concurrency
4545
/// tasks.
46-
@available(SwiftStdlib 9999, *)
46+
@available(SwiftStdlib 6.0, *)
4747
internal final class _DefaultGlobalConcurrentExecutor: TaskExecutor {
4848
public static let shared: _DefaultGlobalConcurrentExecutor = .init()
4949

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ internal func _swiftJobRun(_ job: UnownedJob,
2222
_ executor: UnownedSerialExecutor) -> ()
2323

2424
@_unavailableInEmbedded
25-
@available(SwiftStdlib 9999, *)
25+
@available(SwiftStdlib 6.0, *)
2626
@_silgen_name("swift_job_run_on_task_executor")
2727
@usableFromInline
2828
internal func _swiftJobRunOnTaskExecutor(_ job: UnownedJob,
2929
_ executor: UnownedTaskExecutor) -> ()
3030

3131
@_unavailableInEmbedded
32-
@available(SwiftStdlib 9999, *)
32+
@available(SwiftStdlib 6.0, *)
3333
@_silgen_name("swift_job_run_on_serial_and_task_executor")
3434
@usableFromInline
3535
internal func _swiftJobRunOnTaskExecutor(_ job: UnownedJob,
@@ -110,15 +110,15 @@ public struct UnownedJob: Sendable {
110110
}
111111

112112
@_unavailableInEmbedded
113-
@available(SwiftStdlib 9999, *)
113+
@available(SwiftStdlib 6.0, *)
114114
@_alwaysEmitIntoClient
115115
@inlinable
116116
public func runSynchronously(on executor: UnownedTaskExecutor) {
117117
_swiftJobRunOnTaskExecutor(self, executor)
118118
}
119119

120120
@_unavailableInEmbedded
121-
@available(SwiftStdlib 9999, *)
121+
@available(SwiftStdlib 6.0, *)
122122
@_alwaysEmitIntoClient
123123
@inlinable
124124
public func runSynchronously(isolatedTo serialExecutor: UnownedSerialExecutor,

stdlib/public/Concurrency/Task.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ public func withUnsafeCurrentTask<T>(body: (UnsafeCurrentTask?) throws -> T) ret
911911
return try body(UnsafeCurrentTask(_task))
912912
}
913913

914-
@available(SwiftStdlib 9999, *)
914+
@available(SwiftStdlib 6.0, *)
915915
public func withUnsafeCurrentTask<T>(body: (UnsafeCurrentTask?) async throws -> T) async rethrows -> T {
916916
guard let _task = _getCurrentAsyncTask() else {
917917
return try await body(nil)
@@ -1051,7 +1051,7 @@ internal func _getMainExecutor() -> Builtin.Executor
10511051
///
10521052
/// It is used by default used by tasks and default actors,
10531053
/// unless other executors are specified.
1054-
@available(SwiftStdlib 9999, *)
1054+
@available(SwiftStdlib 6.0, *)
10551055
@usableFromInline
10561056
internal func _getGenericSerialExecutor() -> Builtin.Executor {
10571057
// The `SerialExecutorRef` to "default generic executor" is guaranteed

stdlib/public/Concurrency/TaskGroup+TaskExecutor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Swift
1717
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
1818

1919
@_unavailableInEmbedded
20-
@available(SwiftStdlib 9999, *)
20+
@available(SwiftStdlib 6.0, *)
2121
extension TaskGroup {
2222
/// Adds a child task to the group and enqueue it on the specified executor.
2323
///
@@ -107,7 +107,7 @@ extension TaskGroup {
107107
// ==== ThrowingTaskGroup ------------------------------------------------------------------------------------------------------
108108

109109
@_unavailableInEmbedded
110-
@available(SwiftStdlib 9999, *)
110+
@available(SwiftStdlib 6.0, *)
111111
extension ThrowingTaskGroup {
112112
/// Adds a child task to the group and enqueue it on the specified executor.
113113
///
@@ -194,7 +194,7 @@ extension ThrowingTaskGroup {
194194
// ==== DiscardingTaskGroup ------------------------------------------------------------------------------------------------------
195195

196196
@_unavailableInEmbedded
197-
@available(SwiftStdlib 9999, *)
197+
@available(SwiftStdlib 6.0, *)
198198
extension DiscardingTaskGroup {
199199
/// Adds a child task to the group and enqueue it on the specified executor.
200200
///
@@ -286,7 +286,7 @@ extension DiscardingTaskGroup {
286286
// ==== ThrowingDiscardingTaskGroup ------------------------------------------------------------------------------------------------------
287287

288288
@_unavailableInEmbedded
289-
@available(SwiftStdlib 9999, *)
289+
@available(SwiftStdlib 6.0, *)
290290
extension ThrowingDiscardingTaskGroup {
291291
/// Adds a child task to the group and set it up with the passed in task executor preference.
292292
///

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ func _taskGroupWaitNext<T>(group: Builtin.RawPointer) async throws -> T?
12111211
@_silgen_name("swift_task_hasTaskGroupStatusRecord")
12121212
func _taskHasTaskGroupStatusRecord() -> Bool
12131213

1214-
@available(SwiftStdlib 9999, *)
1214+
@available(SwiftStdlib 6.0, *)
12151215
@_silgen_name("swift_task_hasTaskExecutorStatusRecord")
12161216
func _taskHasTaskExecutorStatusRecord() -> Bool
12171217

stdlib/public/Distributed/DistributedActorSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ public struct DistributedActorCodingError: DistributedActorSystemError {
10561056
/// as a stub always should be used as "remote" and therefore no local calls
10571057
/// are performed on them. Seeing this fatal error means a problem in the Swift
10581058
/// Distributed runtime, please report an issue.
1059-
@available(SwiftStdlib 9999, *)
1059+
@available(SwiftStdlib 6.0, *)
10601060
public // COMPILER_INTRINSIC
10611061
func _diagnoseDistributedStubMethodCalled(
10621062
className: StaticString,

0 commit comments

Comments
 (0)