Skip to content

Commit 71ce719

Browse files
committed
[Concurrency] Fix potential ABI breakages.
Fix a couple of potential ABI breaks. Also add the new functions and types to the baseline lists. rdar://141348916
1 parent 8ef09ef commit 71ce719

File tree

5 files changed

+474
-16
lines changed

5 files changed

+474
-16
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ public protocol Executor: AnyObject, Sendable {
101101
#endif // !$Embedded
102102
}
103103

104-
@available(SwiftStdlib 6.2, *)
105104
extension Executor {
105+
@available(SwiftStdlib 6.2, *)
106106
@usableFromInline
107107
internal var _isComplexEquality: Bool { false }
108108
}
109109

110-
@available(SwiftStdlib 6.2, *)
111110
extension Executor where Self: Equatable {
111+
@available(SwiftStdlib 6.2, *)
112112
@usableFromInline
113113
internal var _isComplexEquality: Bool { true }
114114
}
@@ -581,15 +581,16 @@ public func _createExecutors<F: ExecutorFactory>(factory: F.Type) {
581581
Task._defaultExecutor = factory.defaultExecutor
582582
}
583583

584-
@available(SwiftStdlib 6.2, *)
585584
extension MainActor {
585+
@available(SwiftStdlib 6.2, *)
586586
static var _executor: (any MainExecutor)? = nil
587587

588588
/// The main executor, which is started implicitly by the `async main`
589589
/// entry point and owns the "main" thread.
590590
///
591591
/// Attempting to set this after the first `enqueue` on the main
592592
/// executor is a fatal error.
593+
@available(SwiftStdlib 6.2, *)
593594
public static var executor: any MainExecutor {
594595
if _executor == nil {
595596
_executor = PlatformExecutorFactory.mainExecutor
@@ -598,15 +599,16 @@ extension MainActor {
598599
}
599600
}
600601

601-
@available(SwiftStdlib 6.2, *)
602602
extension Task where Success == Never, Failure == Never {
603+
@available(SwiftStdlib 6.2, *)
603604
static var _defaultExecutor: (any TaskExecutor)? = nil
604605

605606
/// The default or global executor, which is the default place in which
606607
/// we run tasks.
607608
///
608609
/// Attempting to set this after the first `enqueue` on the global
609610
/// executor is a fatal error.
611+
@available(SwiftStdlib 6.2, *)
610612
public static var defaultExecutor: any TaskExecutor {
611613
if _defaultExecutor == nil {
612614
_defaultExecutor = PlatformExecutorFactory.defaultExecutor
@@ -615,10 +617,10 @@ extension Task where Success == Never, Failure == Never {
615617
}
616618
}
617619

618-
@available(SwiftStdlib 6.2, *)
619620
extension Task where Success == Never, Failure == Never {
620621
/// Get the current executor; this is the executor that the currently
621622
/// executing task is executing on.
623+
@available(SwiftStdlib 6.2, *)
622624
@_unavailableInEmbedded
623625
public static var currentExecutor: (any Executor)? {
624626
if let taskExecutor = _getPreferredTaskExecutor().asTaskExecutor() {

stdlib/public/Concurrency/GlobalConcurrentExecutor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal final class _DefaultGlobalConcurrentExecutor: TaskExecutor {
5454
private init() {}
5555

5656
public func enqueue(_ job: consuming ExecutorJob) {
57-
_enqueueJobGlobal(UnownedJob(job))
57+
_enqueueJobGlobal(UnownedJob(job)._context)
5858
}
5959

6060
public func asUnownedTaskExecutor() -> UnownedTaskExecutor {

stdlib/public/Concurrency/Task.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ extension Task where Success == Never, Failure == Never {
12531253
let job = _taskCreateNullaryContinuationJob(
12541254
priority: Int(Task.currentPriority.rawValue),
12551255
continuation: continuation)
1256-
_enqueueJobGlobalDirect(job)
1256+
_enqueueJobGlobal(job)
12571257
}
12581258
}
12591259
}
@@ -1412,22 +1412,24 @@ func getJobFlags(_ task: Builtin.NativeObject) -> JobFlags
14121412
@available(SwiftStdlib 5.1, *)
14131413
@_silgen_name("swift_task_enqueueGlobal")
14141414
@usableFromInline
1415-
func _enqueueJobGlobal(_ task: UnownedJob)
1415+
func _enqueueJobGlobal(_ task: Builtin.Job)
14161416

1417+
@available(SwiftStdlib 6.2, *)
14171418
@usableFromInline
1418-
func _enqueueJobGlobalDirect(_ task: Builtin.Job) {
1419-
if #available(SwiftStdlib 5.9, *) {
1420-
_enqueueJobGlobal(UnownedJob(context: task))
1421-
} else {
1422-
// Shouldn't ever get here
1423-
Builtin.unreachable()
1424-
}
1419+
func _enqueueJobGlobal(_ task: UnownedJob) {
1420+
_enqueueJobGlobal(task._context)
14251421
}
14261422

14271423
@available(SwiftStdlib 5.1, *)
14281424
@_silgen_name("swift_task_enqueueGlobalWithDelay")
14291425
@usableFromInline
1430-
func _enqueueJobGlobalWithDelay(_ delay: UInt64, _ task: UnownedJob)
1426+
func _enqueueJobGlobalWithDelay(_ delay: UInt64, _ task: Builtin.Job)
1427+
1428+
@available(SwiftStdlib 6.2, *)
1429+
@usableFromInline
1430+
func _enqueueJobGlobalWithDelay(_ delay: UInt64, _ task: UnownedJob) {
1431+
return _enqueueJobGlobalWithDelay(delay, task._context)
1432+
}
14311433

14321434
@available(SwiftStdlib 5.7, *)
14331435
@_silgen_name("swift_task_enqueueGlobalWithDeadline")

0 commit comments

Comments
 (0)