Files
swift-mirror/stdlib/public/Concurrency/UnimplementedExecutor.swift
Alastair Houghton f27e20a3e7 [Concurrency] Update availability of UnimplementedExecutor.
We need it to be `StdlibDeploymentTarget 6.2` rather than
`SwiftStdlib 6.2`, so that we can update the availability definitions.

rdar://156710569
2025-07-25 17:02:48 +01:00

64 lines
1.9 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 - 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import Swift
// .. Main Executor ............................................................
@available(StdlibDeploymentTarget 6.2, *)
public final class UnimplementedMainExecutor: MainExecutor, @unchecked Sendable {
public init() {}
public func run() throws {
fatalError("There is no executor implementation active")
}
public func stop() {
fatalError("There is no executor implementation active")
}
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
public func enqueue(_ job: UnownedJob) {
fatalError("There is no executor implementation active")
}
#else
public func enqueue(_ job: consuming ExecutorJob) {
fatalError("There is no executor implementation active")
}
#endif
public var isMainExecutor: Bool { true }
public func checkIsolated() {
// Do nothing
}
}
// .. Task Executor ............................................................
@available(StdlibDeploymentTarget 6.2, *)
public final class UnimplementedTaskExecutor: TaskExecutor, @unchecked Sendable {
public init() {}
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
public func enqueue(_ job: UnownedJob) {
fatalError("There is no executor implementation active")
}
#else
public func enqueue(_ job: consuming ExecutorJob) {
fatalError("There is no executor implementation active")
}
#endif
public var isMainExecutor: Bool { false }
}