Skip to content

Commit bd19d93

Browse files
authored
[TaskExecutor] Remove underscore from new APIs (#71145)
1 parent 0cc5297 commit bd19d93

18 files changed

+119
-119
lines changed

include/swift/AST/ASTSynthesis.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ enum SingletonTypeSynthesizer {
5050
_void,
5151
_word,
5252
_serialExecutor, // the '_Concurrency.SerialExecutor' protocol
53-
_taskExecutor, // the '_Concurrency._TaskExecutor' protocol
53+
_taskExecutor, // the '_Concurrency.TaskExecutor' protocol
5454
};
5555
inline Type synthesizeType(SynthesisContext &SC,
5656
SingletonTypeSynthesizer kind) {
@@ -71,7 +71,7 @@ inline Type synthesizeType(SynthesisContext &SC,
7171
return SC.Context.getProtocol(KnownProtocolKind::SerialExecutor)
7272
->getDeclaredInterfaceType();
7373
case _taskExecutor:
74-
return SC.Context.getProtocol(KnownProtocolKind::_TaskExecutor)
74+
return SC.Context.getProtocol(KnownProtocolKind::TaskExecutor)
7575
->getDeclaredInterfaceType();
7676
}
7777
}

include/swift/AST/KnownProtocols.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ PROTOCOL(FixedWidthInteger)
8686
PROTOCOL(RangeReplaceableCollection)
8787
PROTOCOL(Executor)
8888
PROTOCOL(SerialExecutor)
89-
PROTOCOL(_TaskExecutor)
89+
PROTOCOL(TaskExecutor)
9090
PROTOCOL(GlobalActor)
9191

9292
PROTOCOL_(BridgedNSError)

include/swift/AST/KnownSDKTypes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ KNOWN_SDK_TYPE_DECL(Concurrency, Job, StructDecl, 0) // legacy type; prefer Exec
4444
KNOWN_SDK_TYPE_DECL(Concurrency, ExecutorJob, StructDecl, 0)
4545
KNOWN_SDK_TYPE_DECL(Concurrency, UnownedJob, StructDecl, 0)
4646
KNOWN_SDK_TYPE_DECL(Concurrency, Executor, NominalTypeDecl, 0)
47-
KNOWN_SDK_TYPE_DECL(Concurrency, _TaskExecutor, NominalTypeDecl, 0)
47+
KNOWN_SDK_TYPE_DECL(Concurrency, TaskExecutor, NominalTypeDecl, 0)
4848
KNOWN_SDK_TYPE_DECL(Concurrency, SerialExecutor, NominalTypeDecl, 0)
4949
KNOWN_SDK_TYPE_DECL(Concurrency, UnownedSerialExecutor, NominalTypeDecl, 0)
5050

include/swift/Demangling/StandardTypesMangling.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ STANDARD_TYPE_CONCURRENCY(Protocol, F, Executor)
8888
STANDARD_TYPE_CONCURRENCY(Protocol, f, SerialExecutor)
8989
STANDARD_TYPE_CONCURRENCY(Structure, G, TaskGroup)
9090
STANDARD_TYPE_CONCURRENCY(Structure, g, ThrowingTaskGroup)
91-
STANDARD_TYPE_CONCURRENCY(Protocol, h, _TaskExecutor)
91+
STANDARD_TYPE_CONCURRENCY(Protocol, h, TaskExecutor)
9292
STANDARD_TYPE_CONCURRENCY(Protocol, I, AsyncIteratorProtocol)
9393
STANDARD_TYPE_CONCURRENCY(Protocol, i, AsyncSequence)
9494
STANDARD_TYPE_CONCURRENCY(Structure, J, UnownedJob)

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ ProtocolDecl *ASTContext::getProtocol(KnownProtocolKind kind) const {
12181218
case KnownProtocolKind::AsyncSequence:
12191219
case KnownProtocolKind::AsyncIteratorProtocol:
12201220
case KnownProtocolKind::Executor:
1221-
case KnownProtocolKind::_TaskExecutor:
1221+
case KnownProtocolKind::TaskExecutor:
12221222
case KnownProtocolKind::SerialExecutor:
12231223
M = getLoadedModule(Id_Concurrency);
12241224
break;

lib/IRGen/GenMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6574,7 +6574,7 @@ SpecialProtocol irgen::getSpecialProtocolID(ProtocolDecl *P) {
65746574
case KnownProtocolKind::UnsafeCxxMutableRandomAccessIterator:
65756575
case KnownProtocolKind::Executor:
65766576
case KnownProtocolKind::SerialExecutor:
6577-
case KnownProtocolKind::_TaskExecutor:
6577+
case KnownProtocolKind::TaskExecutor:
65786578
case KnownProtocolKind::Sendable:
65796579
case KnownProtocolKind::UnsafeSendable:
65806580
case KnownProtocolKind::RangeReplaceableCollection:

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ void swift::tryDiagnoseExecutorConformance(ASTContext &C,
13891389
ProtocolDecl *proto) {
13901390
assert(proto->isSpecificProtocol(KnownProtocolKind::Executor) ||
13911391
proto->isSpecificProtocol(KnownProtocolKind::SerialExecutor) ||
1392-
proto->isSpecificProtocol(KnownProtocolKind::_TaskExecutor));
1392+
proto->isSpecificProtocol(KnownProtocolKind::TaskExecutor));
13931393

13941394
auto &diags = C.Diags;
13951395
auto module = nominal->getParentModule();

stdlib/public/Concurrency/Actor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,8 +1450,8 @@ static void defaultActorDrain(DefaultActorImpl *actor) {
14501450
ExecutorTrackingInfo trackingInfo;
14511451
trackingInfo.enterAndShadow(
14521452
SerialExecutorRef::forDefaultActor(asAbstract(currentActor)),
1453-
/*taskExecutor, will be replaced per each job. */ TaskExecutorRef::
1454-
undefined());
1453+
/*taskExecutor, will be replaced per each job. */
1454+
TaskExecutorRef::undefined());
14551455

14561456
while (true) {
14571457
if (shouldYieldThread()) {

stdlib/public/Concurrency/Executor.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ public protocol SerialExecutor: Executor {
113113
/// requirements.
114114
///
115115
/// By setting a task executor preference, either with a
116-
/// ``_withTaskExecutorPreference(_:operation:)``, creating a task with a preference
117-
/// (`Task(_executorPreference:)`, or `group.addTask(executorPreference:)`), the task and all of its child
116+
/// ``withTaskExecutorPreference(_:operation:)``, creating a task with a preference
117+
/// (`Task(executorPreference:)`, or `group.addTask(executorPreference:)`), the task and all of its child
118118
/// tasks (unless a new preference is set) will be preferring to execute on
119119
/// the provided task executor.
120120
///
121121
/// Unstructured tasks do not inherit the task executor.
122122
@_unavailableInEmbedded
123123
@available(SwiftStdlib 9999, *)
124-
public protocol _TaskExecutor: Executor {
124+
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
127127
// avoid drilling down to the base conformance just for the basic
@@ -153,7 +153,7 @@ public protocol _TaskExecutor: Executor {
153153

154154
@_unavailableInEmbedded
155155
@available(SwiftStdlib 9999, *)
156-
extension _TaskExecutor {
156+
extension TaskExecutor {
157157
public func asUnownedTaskExecutor() -> UnownedTaskExecutor {
158158
UnownedTaskExecutor(ordinary: self)
159159
}
@@ -293,7 +293,7 @@ public struct UnownedTaskExecutor: Sendable {
293293
}
294294

295295
@inlinable
296-
public init<E: _TaskExecutor>(ordinary executor: __shared E) {
296+
public init<E: TaskExecutor>(ordinary executor: __shared E) {
297297
#if $BuiltinBuildTaskExecutor
298298
self.executor = Builtin.buildOrdinaryTaskExecutorRef(executor)
299299
#else
@@ -375,7 +375,7 @@ internal func _task_serialExecutor_getExecutorRef<E>(_ executor: E) -> Builtin.E
375375
@_unavailableInEmbedded
376376
@available(SwiftStdlib 9999, *)
377377
@_silgen_name("_task_executor_getTaskExecutorRef")
378-
internal func _task_executor_getTaskExecutorRef(_ taskExecutor: any _TaskExecutor) -> Builtin.Executor {
378+
internal func _task_executor_getTaskExecutorRef(_ taskExecutor: any TaskExecutor) -> Builtin.Executor {
379379
return taskExecutor.asUnownedTaskExecutor().executor
380380
}
381381

@@ -398,7 +398,7 @@ where E: SerialExecutor {
398398
@_unavailableInEmbedded
399399
@available(SwiftStdlib 9999, *)
400400
@_silgen_name("_swift_task_enqueueOnTaskExecutor")
401-
internal func _enqueueOnTaskExecutor<E>(job unownedJob: UnownedJob, executor: E) where E: _TaskExecutor {
401+
internal func _enqueueOnTaskExecutor<E>(job unownedJob: UnownedJob, executor: E) where E: TaskExecutor {
402402
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
403403
executor.enqueue(ExecutorJob(context: unownedJob._context))
404404
#else // SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

stdlib/public/Concurrency/GlobalConcurrentExecutor.swift

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

16-
// None of _TaskExecutor APIs are available in task-to-thread concurrency model.
16+
// None of TaskExecutor APIs are available in task-to-thread concurrency model.
1717
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
1818

1919
/// The global concurrent executor that is used by default for Swift Concurrency
@@ -27,13 +27,13 @@ import Swift
2727
/// You may pass this executor explicitly to a ``Task`` initializer as a task
2828
/// executor preference, in order to ensure and document that task be executed
2929
/// on the global executor, instead e.g. inheriting the enclosing actor's
30-
/// executor. Refer to ``_withTaskExecutorPreference(_:operation:)`` for a
30+
/// executor. Refer to ``withTaskExecutorPreference(_:operation:)`` for a
3131
/// detailed discussion of task executor preferences.
3232
///
3333
/// Customizing the global concurrent executor is currently not supported.
3434
@available(SwiftStdlib 9999, *)
3535
nonisolated(unsafe)
36-
public var globalConcurrentExecutor: any _TaskExecutor {
36+
public var globalConcurrentExecutor: any TaskExecutor {
3737
get {
3838
_DefaultGlobalConcurrentExecutor.shared
3939
}
@@ -45,7 +45,7 @@ public var globalConcurrentExecutor: any _TaskExecutor {
4545
/// thread pool that is used as the default executor for Swift concurrency
4646
/// tasks.
4747
@available(SwiftStdlib 9999, *)
48-
internal final class _DefaultGlobalConcurrentExecutor: _TaskExecutor {
48+
internal final class _DefaultGlobalConcurrentExecutor: TaskExecutor {
4949
public static let shared: _DefaultGlobalConcurrentExecutor = .init()
5050

5151
private init() {}

stdlib/public/Concurrency/Task+TaskExecutor.swift

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

16-
// None of _TaskExecutor APIs are available in task-to-thread concurrency model.
16+
// None of TaskExecutor APIs are available in task-to-thread concurrency model.
1717
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
1818

19-
/// Configure the current task hierarchy's task executor preference to the passed ``_TaskExecutor``,
19+
/// Configure the current task hierarchy's task executor preference to the passed ``TaskExecutor``,
2020
/// and execute the passed in closure by immediately hopping to that executor.
2121
///
2222
/// ### Task executor preference semantics
2323
/// Task executors influence _where_ nonisolated asynchronous functions, and default actor methods execute.
2424
/// The preferred executor will be used whenever possible, rather than hopping to the global concurrent pool.
2525
///
26-
/// For an in depth discussion of this topic, see ``_TaskExecutor``.
26+
/// For an in depth discussion of this topic, see ``TaskExecutor``.
2727
///
2828
/// ### Disabling task executor preference
2929
/// Passing `nil` as executor means disabling any preference preference (if it was set) and the task hierarchy
@@ -126,12 +126,12 @@ import Swift
126126
/// - operation: the operation to execute on the passed executor
127127
/// - Returns: the value returned from the `operation` closure
128128
/// - Throws: if the operation closure throws
129-
/// - SeeAlso: ``_TaskExecutor``
129+
/// - SeeAlso: ``TaskExecutor``
130130
@_unavailableInEmbedded
131131
@available(SwiftStdlib 9999, *)
132132
@_unsafeInheritExecutor // calling withTaskExecutor MUST NOT perform the "usual" hop to global
133-
public func _withTaskExecutorPreference<T: Sendable>(
134-
_ taskExecutor: (any _TaskExecutor)?,
133+
public func withTaskExecutorPreference<T: Sendable>(
134+
_ taskExecutor: (any TaskExecutor)?,
135135
operation: @Sendable () async throws -> T
136136
) async rethrows -> T {
137137
guard let taskExecutor else {
@@ -166,9 +166,9 @@ extension Task where Failure == Never {
166166
/// Runs the given nonthrowing operation asynchronously
167167
/// as part of a new top-level task on behalf of the current actor.
168168
///
169-
/// This overload allows specifying a preferred ``_TaskExecutor`` on which
169+
/// This overload allows specifying a preferred ``TaskExecutor`` on which
170170
/// the `operation`, as well as all child tasks created from this task will be
171-
/// executing whenever possible. Refer to ``_TaskExecutor`` for a detailed discussion
171+
/// executing whenever possible. Refer to ``TaskExecutor`` for a detailed discussion
172172
/// of the effect of task executors on execution semantics of asynchronous code.
173173
///
174174
/// Use this function when creating asynchronous work
@@ -194,11 +194,11 @@ extension Task where Failure == Never {
194194
/// - priority: The priority of the task.
195195
/// Pass `nil` to use the priority from `Task.currentPriority`.
196196
/// - operation: The operation to perform.
197-
/// - SeeAlso: ``_withTaskExecutorPreference(_:operation:)``
197+
/// - SeeAlso: ``withTaskExecutorPreference(_:operation:)``
198198
@discardableResult
199199
@_alwaysEmitIntoClient
200200
public init(
201-
_executorPreference taskExecutor: (any _TaskExecutor)?,
201+
executorPreference taskExecutor: (any TaskExecutor)?,
202202
priority: TaskPriority? = nil,
203203
operation: __owned @Sendable @escaping () async -> Success
204204
) {
@@ -255,11 +255,11 @@ extension Task where Failure == Error {
255255
/// - priority: The priority of the task.
256256
/// Pass `nil` to use the priority from `Task.currentPriority`.
257257
/// - operation: The operation to perform.
258-
/// - SeeAlso: ``_withTaskExecutorPreference(_:operation:)``
258+
/// - SeeAlso: ``withTaskExecutorPreference(_:operation:)``
259259
@discardableResult
260260
@_alwaysEmitIntoClient
261261
public init(
262-
_executorPreference taskExecutor: (any _TaskExecutor)?,
262+
executorPreference taskExecutor: (any TaskExecutor)?,
263263
priority: TaskPriority? = nil,
264264
operation: __owned @Sendable @escaping () async throws -> Success
265265
) {
@@ -314,11 +314,11 @@ extension Task where Failure == Never {
314314
/// Pass `nil` to use the priority from `Task.currentPriority`.
315315
/// - operation: The operation to perform.
316316
/// - Returns: A reference to the newly created task.
317-
/// - SeeAlso: ``_withTaskExecutorPreference(_:operation:)``
317+
/// - SeeAlso: ``withTaskExecutorPreference(_:operation:)``
318318
@discardableResult
319319
@_alwaysEmitIntoClient
320-
public static func _detached(
321-
_executorPreference taskExecutor: (any _TaskExecutor)?,
320+
public static func detached(
321+
executorPreference taskExecutor: (any TaskExecutor)?,
322322
priority: TaskPriority? = nil,
323323
operation: __owned @Sendable @escaping () async -> Success
324324
) -> Task<Success, Failure> {
@@ -373,11 +373,11 @@ extension Task where Failure == Error {
373373
/// Pass `nil` to use the priority from `Task.currentPriority`.
374374
/// - operation: The operation to perform.
375375
/// - Returns: A reference to the newly created task.
376-
/// - SeeAlso: ``_withTaskExecutorPreference(_:operation:)``
376+
/// - SeeAlso: ``withTaskExecutorPreference(_:operation:)``
377377
@discardableResult
378378
@_alwaysEmitIntoClient
379-
public static func _detached(
380-
_executorPreference taskExecutor: (any _TaskExecutor)?,
379+
public static func detached(
380+
executorPreference taskExecutor: (any TaskExecutor)?,
381381
priority: TaskPriority? = nil,
382382
operation: __owned @Sendable @escaping () async throws -> Success
383383
) -> Task<Success, Failure> {
@@ -410,15 +410,15 @@ extension Task where Failure == Error {
410410
@available(SwiftStdlib 9999, *)
411411
extension UnsafeCurrentTask {
412412

413-
/// The current ``_TaskExecutor`` preference, if this task has one configured.
413+
/// The current ``TaskExecutor`` preference, if this task has one configured.
414414
///
415415
/// The executor may be used to compare for equality with an expected executor preference.
416416
///
417417
/// The lifetime of an executor is not guaranteed by an ``UnownedTaskExecutor``,
418418
/// so accessing it must be handled with great case -- and the program must use other
419419
/// means to guarantee the executor remains alive while it is in use.
420420
@available(SwiftStdlib 9999, *)
421-
public var _unownedTaskExecutor: UnownedTaskExecutor? {
421+
public var unownedTaskExecutor: UnownedTaskExecutor? {
422422
let ref = _getPreferredTaskExecutor()
423423
return UnownedTaskExecutor(ref)
424424
}

0 commit comments

Comments
 (0)