13
13
import Swift
14
14
@_implementationOnly import _SwiftConcurrencyShims
15
15
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.
17
17
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
18
18
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 ``,
20
20
/// and execute the passed in closure by immediately hopping to that executor.
21
21
///
22
22
/// ### Task executor preference semantics
23
23
/// Task executors influence _where_ nonisolated asynchronous functions, and default actor methods execute.
24
24
/// The preferred executor will be used whenever possible, rather than hopping to the global concurrent pool.
25
25
///
26
- /// For an in depth discussion of this topic, see ``_TaskExecutor ``.
26
+ /// For an in depth discussion of this topic, see ``TaskExecutor ``.
27
27
///
28
28
/// ### Disabling task executor preference
29
29
/// Passing `nil` as executor means disabling any preference preference (if it was set) and the task hierarchy
@@ -126,12 +126,12 @@ import Swift
126
126
/// - operation: the operation to execute on the passed executor
127
127
/// - Returns: the value returned from the `operation` closure
128
128
/// - Throws: if the operation closure throws
129
- /// - SeeAlso: ``_TaskExecutor ``
129
+ /// - SeeAlso: ``TaskExecutor ``
130
130
@_unavailableInEmbedded
131
131
@available ( SwiftStdlib 9999 , * )
132
132
@_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 ) ? ,
135
135
operation: @Sendable ( ) async throws -> T
136
136
) async rethrows -> T {
137
137
guard let taskExecutor else {
@@ -166,9 +166,9 @@ extension Task where Failure == Never {
166
166
/// Runs the given nonthrowing operation asynchronously
167
167
/// as part of a new top-level task on behalf of the current actor.
168
168
///
169
- /// This overload allows specifying a preferred ``_TaskExecutor `` on which
169
+ /// This overload allows specifying a preferred ``TaskExecutor `` on which
170
170
/// 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
172
172
/// of the effect of task executors on execution semantics of asynchronous code.
173
173
///
174
174
/// Use this function when creating asynchronous work
@@ -194,11 +194,11 @@ extension Task where Failure == Never {
194
194
/// - priority: The priority of the task.
195
195
/// Pass `nil` to use the priority from `Task.currentPriority`.
196
196
/// - operation: The operation to perform.
197
- /// - SeeAlso: ``_withTaskExecutorPreference (_:operation:)``
197
+ /// - SeeAlso: ``withTaskExecutorPreference (_:operation:)``
198
198
@discardableResult
199
199
@_alwaysEmitIntoClient
200
200
public init (
201
- _executorPreference taskExecutor: ( any _TaskExecutor ) ? ,
201
+ executorPreference taskExecutor: ( any TaskExecutor ) ? ,
202
202
priority: TaskPriority ? = nil ,
203
203
operation: __owned @Sendable @escaping ( ) async -> Success
204
204
) {
@@ -255,11 +255,11 @@ extension Task where Failure == Error {
255
255
/// - priority: The priority of the task.
256
256
/// Pass `nil` to use the priority from `Task.currentPriority`.
257
257
/// - operation: The operation to perform.
258
- /// - SeeAlso: ``_withTaskExecutorPreference (_:operation:)``
258
+ /// - SeeAlso: ``withTaskExecutorPreference (_:operation:)``
259
259
@discardableResult
260
260
@_alwaysEmitIntoClient
261
261
public init (
262
- _executorPreference taskExecutor: ( any _TaskExecutor ) ? ,
262
+ executorPreference taskExecutor: ( any TaskExecutor ) ? ,
263
263
priority: TaskPriority ? = nil ,
264
264
operation: __owned @Sendable @escaping ( ) async throws -> Success
265
265
) {
@@ -314,11 +314,11 @@ extension Task where Failure == Never {
314
314
/// Pass `nil` to use the priority from `Task.currentPriority`.
315
315
/// - operation: The operation to perform.
316
316
/// - Returns: A reference to the newly created task.
317
- /// - SeeAlso: ``_withTaskExecutorPreference (_:operation:)``
317
+ /// - SeeAlso: ``withTaskExecutorPreference (_:operation:)``
318
318
@discardableResult
319
319
@_alwaysEmitIntoClient
320
- public static func _detached (
321
- _executorPreference taskExecutor: ( any _TaskExecutor ) ? ,
320
+ public static func detached (
321
+ executorPreference taskExecutor: ( any TaskExecutor ) ? ,
322
322
priority: TaskPriority ? = nil ,
323
323
operation: __owned @Sendable @escaping ( ) async -> Success
324
324
) -> Task < Success , Failure > {
@@ -373,11 +373,11 @@ extension Task where Failure == Error {
373
373
/// Pass `nil` to use the priority from `Task.currentPriority`.
374
374
/// - operation: The operation to perform.
375
375
/// - Returns: A reference to the newly created task.
376
- /// - SeeAlso: ``_withTaskExecutorPreference (_:operation:)``
376
+ /// - SeeAlso: ``withTaskExecutorPreference (_:operation:)``
377
377
@discardableResult
378
378
@_alwaysEmitIntoClient
379
- public static func _detached (
380
- _executorPreference taskExecutor: ( any _TaskExecutor ) ? ,
379
+ public static func detached (
380
+ executorPreference taskExecutor: ( any TaskExecutor ) ? ,
381
381
priority: TaskPriority ? = nil ,
382
382
operation: __owned @Sendable @escaping ( ) async throws -> Success
383
383
) -> Task < Success , Failure > {
@@ -410,15 +410,15 @@ extension Task where Failure == Error {
410
410
@available ( SwiftStdlib 9999 , * )
411
411
extension UnsafeCurrentTask {
412
412
413
- /// The current ``_TaskExecutor `` preference, if this task has one configured.
413
+ /// The current ``TaskExecutor `` preference, if this task has one configured.
414
414
///
415
415
/// The executor may be used to compare for equality with an expected executor preference.
416
416
///
417
417
/// The lifetime of an executor is not guaranteed by an ``UnownedTaskExecutor``,
418
418
/// so accessing it must be handled with great case -- and the program must use other
419
419
/// means to guarantee the executor remains alive while it is in use.
420
420
@available ( SwiftStdlib 9999 , * )
421
- public var _unownedTaskExecutor : UnownedTaskExecutor ? {
421
+ public var unownedTaskExecutor : UnownedTaskExecutor ? {
422
422
let ref = _getPreferredTaskExecutor ( )
423
423
return UnownedTaskExecutor ( ref)
424
424
}
0 commit comments