@@ -127,11 +127,12 @@ extension Executor where Self: Equatable {
127
127
}
128
128
129
129
extension Executor {
130
-
131
130
#if os(WASI) || !$Embedded
131
+ // This defaults to `false` so that existing third-party Executor
132
+ // implementations will work as expected.
132
133
@available ( StdlibDeploymentTarget 6 . 2 , * )
133
134
var isMainExecutor : Bool { false }
134
- #endif
135
+ #endif // os(WASI) || !$Embedded
135
136
136
137
}
137
138
@@ -346,10 +347,10 @@ public protocol SerialExecutor: Executor {
346
347
@available ( StdlibDeploymentTarget 6 . 0 , * )
347
348
extension SerialExecutor {
348
349
349
- #if ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
350
+ #if os(WASI) || (!$Embedded && ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
350
351
@available ( StdlibDeploymentTarget 6 . 2 , * )
351
352
var isMainExecutor : Bool { return MainActor . executor. _isSameExecutor ( self ) }
352
- #endif
353
+ #endif // os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
353
354
354
355
@available ( StdlibDeploymentTarget 6 . 0 , * )
355
356
public func checkIsolated( ) {
@@ -556,6 +557,7 @@ protocol ExecutorFactory {
556
557
/// Constructs and returns the main executor, which is started implicitly
557
558
/// by the `async main` entry point and owns the "main" thread.
558
559
static var mainExecutor : any MainExecutor { get }
560
+ #endif // os(WASI) || !$Embedded
559
561
560
562
/// Constructs and returns the default or global executor, which is the
561
563
/// default place in which we run tasks.
@@ -570,7 +572,7 @@ typealias DefaultExecutorFactory = PlatformExecutorFactory
570
572
func _createExecutors< F: ExecutorFactory > ( factory: F . Type ) {
571
573
#if os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
572
574
MainActor . _executor = factory. mainExecutor
573
- #endif
575
+ #endif // os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
574
576
Task . _defaultExecutor = factory. defaultExecutor
575
577
}
576
578
0 commit comments