_Concurrency
import _ConcurrencyModule information
- Declarations
- 519
- Symbols
- 1022
import _Concurrencyvar globalConcurrentExecutor: any TaskExecutor { get }The global concurrent executor that is used by default for Swift Concurrency tasks.
func extractIsolation<each Arg, Result>(_ fn: @escaping @isolated(any) (repeat each Arg) async throws -> Result) -> (any Actor)? @backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withCheckedContinuation<T>(isolation: isolated (any Actor)? = #isolation, function: String = #function, _ body: (CheckedContinuation<T, Never>) -> Void) async -> sending T Invokes the passed in closure with a checked continuation for the current task.
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withCheckedThrowingContinuation<T>(isolation: isolated (any Actor)? = #isolation, function: String = #function, _ body: (CheckedContinuation<T, any Error>) -> Void) async throws -> sending T Invokes the passed in closure with a checked continuation for the current task.
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withDiscardingTaskGroup<GroupResult>(returning returnType: GroupResult.Type = GroupResult.self, isolation: isolated (any Actor)? = #isolation, body: (inout DiscardingTaskGroup) async -> GroupResult) async -> GroupResult Starts a new scope that can contain a dynamic number of child tasks.
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withTaskCancellationHandler<T>(operation: () async throws -> T, onCancel handler: () -> Void, isolation: isolated (any Actor)? = #isolation) async rethrows -> T Execute an operation with a cancellation handler that’s immediately invoked if the current task is canceled.
func withTaskExecutorPreference<T, Failure>(_ taskExecutor: (any TaskExecutor)?, isolation: isolated (any Actor)? = #isolation, operation: () async throws(Failure) -> T) async throws(Failure) -> T where Failure : Error Configure the current task hierarchy’s task executor preference to the passed TaskExecutor, and execute the passed in closure by immediately hopping to that executor.
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withTaskGroup<ChildTaskResult, GroupResult>(of childTaskResultType: ChildTaskResult.Type = ChildTaskResult.self, returning returnType: GroupResult.Type = GroupResult.self, isolation: isolated (any Actor)? = #isolation, body: (inout TaskGroup<ChildTaskResult>) async -> GroupResult) async -> GroupResult where ChildTaskResult : Sendable Starts a new scope that can contain a dynamic number of child tasks.
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withThrowingDiscardingTaskGroup<GroupResult>(returning returnType: GroupResult.Type = GroupResult.self, isolation: isolated (any Actor)? = #isolation, body: (inout ThrowingDiscardingTaskGroup<any Error>) async throws -> GroupResult) async throws -> GroupResult Starts a new scope that can contain a dynamic number of child tasks.
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0) func withThrowingTaskGroup<ChildTaskResult, GroupResult>(of childTaskResultType: ChildTaskResult.Type = ChildTaskResult.self, returning returnType: GroupResult.Type = GroupResult.self, isolation: isolated (any Actor)? = #isolation, body: (inout ThrowingTaskGroup<ChildTaskResult, any Error>) async throws -> GroupResult) async rethrows -> GroupResult where ChildTaskResult : Sendable Starts a new scope that can contain a dynamic number of throwing child tasks.
func withUnsafeContinuation<T>(isolation: isolated (any Actor)? = #isolation, _ fn: (UnsafeContinuation<T, Never>) -> Void) async -> sending T Invokes the passed in closure with a unsafe continuation for the current task.
func withUnsafeCurrentTask<T>(body: (UnsafeCurrentTask?) throws -> T) rethrows -> T Calls a closure with an unsafe reference to the current task.
func withUnsafeCurrentTask<T>(body: (UnsafeCurrentTask?) async throws -> T) async rethrows -> T func withUnsafeThrowingContinuation<T>(isolation: isolated (any Actor)? = #isolation, _ fn: (UnsafeContinuation<T, any Error>) -> Void) async throws -> sending T Invokes the passed in closure with a unsafe continuation for the current task.
protocol Actor : AnyObject, SendableCommon protocol to which all actors conform.
protocol AsyncIteratorProtocol<Element, Failure>A type that asynchronously supplies the values of a sequence one at a time.
protocol AsyncSequence<Element, Failure>A type that provides asynchronous, sequential, iterated access to its elements.
protocol Clock<Duration> : SendableA mechanism in which to measure time, and delay work until a given point in time.
protocol Executor : AnyObject, SendableA service that can execute jobs.
protocol GlobalActorA type that represents a globally-unique actor that can be used to isolate various declarations anywhere in the program.
protocol SerialExecutor : ExecutorA service that executes jobs.
protocol TaskExecutor : ExecutorAn executor that may be used as preferred executor by a task.
struct AsyncCompactMapSequence<Base, ElementOfResult> where Base : AsyncSequenceAn asynchronous sequence that maps a given closure over the asynchronous sequence’s elements, omitting results that don’t return a value.
struct AsyncDropFirstSequence<Base> where Base : AsyncSequenceAn asynchronous sequence which omits a specified number of elements from the base asynchronous sequence, then passes through all remaining elements.
struct AsyncDropWhileSequence<Base> where Base : AsyncSequenceAn asynchronous sequence which omits elements from the base sequence until a given closure returns false, after which it passes through all remaining elements.
struct AsyncFilterSequence<Base> where Base : AsyncSequenceAn asynchronous sequence that contains, in order, the elements of the base sequence that satisfy a given predicate.
struct AsyncFlatMapSequence<Base, SegmentOfResult> where Base : AsyncSequence, SegmentOfResult : AsyncSequenceAn asynchronous sequence that concatenates the results of calling a given transformation with each element of this sequence.
struct AsyncMapSequence<Base, Transformed> where Base : AsyncSequenceAn asynchronous sequence that maps the given closure over the asynchronous sequence’s elements.
struct AsyncPrefixSequence<Base> where Base : AsyncSequenceAn asynchronous sequence, up to a specified maximum length, containing the initial elements of a base asynchronous sequence.
struct AsyncPrefixWhileSequence<Base> where Base : AsyncSequenceAn asynchronous sequence, containing the initial, consecutive elements of the base sequence that satisfy a given predicate.
struct AsyncStream<Element>An asynchronous sequence generated from a closure that calls a continuation to produce new elements.
struct AsyncThrowingCompactMapSequence<Base, ElementOfResult> where Base : AsyncSequenceAn asynchronous sequence that maps an error-throwing closure over the base sequence’s elements, omitting results that don’t return a value.
struct AsyncThrowingDropWhileSequence<Base> where Base : AsyncSequenceAn asynchronous sequence which omits elements from the base sequence until a given error-throwing closure returns false, after which it passes through all remaining elements.
struct AsyncThrowingFilterSequence<Base> where Base : AsyncSequenceAn asynchronous sequence that contains, in order, the elements of the base sequence that satisfy the given error-throwing predicate.
struct AsyncThrowingFlatMapSequence<Base, SegmentOfResult> where Base : AsyncSequence, SegmentOfResult : AsyncSequenceAn asynchronous sequence that concatenates the results of calling a given error-throwing transformation with each element of this sequence.
struct AsyncThrowingMapSequence<Base, Transformed> where Base : AsyncSequenceAn asynchronous sequence that maps the given error-throwing closure over the asynchronous sequence’s elements.
struct AsyncThrowingPrefixWhileSequence<Base> where Base : AsyncSequenceAn asynchronous sequence, containing the initial, consecutive elements of the base sequence that satisfy the given error-throwing predicate.
struct AsyncThrowingStream<Element, Failure> where Failure : ErrorAn asynchronous sequence generated from an error-throwing closure that calls a continuation to produce new elements.
struct CancellationErrorAn error that indicates a task was canceled.
struct CheckedContinuation<T, E> where E : ErrorA mechanism to interface between synchronous and asynchronous code, logging correctness violations.
struct ContinuousClockA clock that measures time that always increments and does not stop incrementing while the system is asleep.
@frozen struct DiscardingTaskGroupA discarding group that contains dynamically created child tasks.
@frozen struct ExecutorJobA unit of schedulable work.
@frozen struct JobPriorityThe priority of this job.
@globalActor final actor MainActorA singleton actor whose executor is equivalent to the main dispatch queue.
struct SuspendingClockA clock that measures time that always increments but stops incrementing while the system is asleep.
@frozen struct Task<Success, Failure> where Success : Sendable, Failure : ErrorA unit of asynchronous work.
@frozen struct TaskGroup<ChildTaskResult> where ChildTaskResult : SendableA group that contains dynamically created child tasks.
final class TaskLocal<Value> where Value : SendableWrapper type that defines a task-local value key.
struct TaskPriorityThe priority of a task.
@frozen struct ThrowingDiscardingTaskGroup<Failure> where Failure : ErrorA throwing discarding group that contains dynamically created child tasks.
@frozen struct ThrowingTaskGroup<ChildTaskResult, Failure> where ChildTaskResult : Sendable, Failure : ErrorA group that contains throwing, dynamically created child tasks.
@frozen struct UnownedJobA unit of schedulable work.
@frozen struct UnownedSerialExecutorAn unowned reference to a serial executor (a SerialExecutor value).
@frozen struct UnownedTaskExecutor@frozen struct UnsafeContinuation<T, E> where E : ErrorA mechanism to interface between synchronous and asynchronous code, without correctness checking.
struct UnsafeCurrentTaskAn unsafe reference to the current task.
@attached(accessor) @attached(peer, names: prefixed(`$`)) macro TaskLocal() Macro that introduces a TaskLocal-class binding.
@freestanding(expression) macro isolation<T>() -> T Produce a reference to the actor to which the enclosing code is isolated, or nil if the code is nonisolated.
@discardableResult func async<T>(priority: TaskPriority? = nil, operation: @escaping () async throws -> T) -> Task<T, any Error> where T : Sendable @discardableResult func async<T>(priority: TaskPriority? = nil, operation: @escaping () async -> T) -> Task<T, Never> where T : Sendable @discardableResult func asyncDetached<T>(priority: TaskPriority? = nil, operation: @escaping () async throws -> T) -> Task<T, any Error> where T : Sendable @discardableResult func asyncDetached<T>(priority: TaskPriority? = nil, operation: @escaping () async -> T) -> Task<T, Never> where T : Sendable @discardableResult func detach<T>(priority: TaskPriority? = nil, operation: @escaping () async throws -> T) -> Task<T, any Error> where T : Sendable @discardableResult func detach<T>(priority: TaskPriority? = nil, operation: @escaping () async -> T) -> Task<T, Never> where T : Sendable func withTaskCancellationHandler<T>(handler: () -> Void, operation: () async throws -> T) async rethrows -> T @frozen struct JobDeprecated equivalent of ExecutorJob.
typealias AnyActor = AnyObject & SendableCommon marker protocol providing a shared “base” for both (local) Actor and (potentially remote) DistributedActor types.
typealias PartialAsyncTask = UnownedJobtypealias UnsafeThrowingContinuation<T> = UnsafeContinuation<T, any Error>import Cxximport Dispatchimport DispatchIntrospectionimport Distributedimport Foundationimport FoundationNetworkingimport FoundationXMLimport RegexBuilderimport Swiftimport XCTestimport _Differentiationimport _RegexParserimport _StringProcessing