Skip to content

Commit 75a3cac

Browse files
committed
[Concurrency] Hide the _withSerialExecutor, we will introduce executor
1 parent fe0889b commit 75a3cac

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,17 @@ public protocol SchedulableExecutor: Executor {
9595

9696
extension Actor {
9797

98-
/// Perform an operation with the actor's ``SerialExecutor``.
99-
///
100-
/// This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while
101-
/// retaining the actor for the duration of the operation. This is to ensure the lifetime
102-
/// of the executor while performing the operation.
98+
// FIXME: SE evolution: these should be removed in favor of an 'executor' property
10399
@_alwaysEmitIntoClient
104100
@available(SwiftStdlib 5.1, *)
105-
public nonisolated func withSerialExecutor<T>(_ operation: (any SerialExecutor) throws -> T) rethrows -> T {
101+
public nonisolated func _withSerialExecutor<T>(_ operation: (any SerialExecutor) throws -> T) rethrows -> T {
106102
try operation(unsafe unsafeBitCast(self.unownedExecutor, to: (any SerialExecutor).self))
107103
}
108104

109-
/// Perform an operation with the actor's ``SerialExecutor``.
110-
///
111-
/// This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while
112-
/// retaining the actor for the duration of the operation. This is to ensure the lifetime
113-
/// of the executor while performing the operation.
105+
// FIXME: SE evolution: these should be removed in favor of an 'executor' property
114106
@_alwaysEmitIntoClient
115107
@available(SwiftStdlib 5.1, *)
116-
public nonisolated func withSerialExecutor<T>(_ operation: (any SerialExecutor) async throws -> T) async rethrows -> T {
108+
public nonisolated func _withSerialExecutor<T>(_ operation: (any SerialExecutor) async throws -> T) async rethrows -> T {
117109
try await operation(unsafe unsafeBitCast(self.unownedExecutor, to: (any SerialExecutor).self))
118110
}
119111
}

test/Concurrency/Runtime/actor_isIsolatingCurrentContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ actor ActorOnIsCheckImplementingExecutor<Ex: SerialExecutor> {
113113

114114
let anyActor: any Actor = hasIsCheckActor
115115

116-
anyActor.withSerialExecutor { se in
116+
anyActor._withSerialExecutor { se in
117117
let outside = se.isIsolatingCurrentContext()
118118
assert(outside == true) // This is just a mock executor impl that always returns "true" (it is lying)
119119
// CHECK: called: isIsolatingCurrentContext

0 commit comments

Comments
 (0)