@@ -36,9 +36,11 @@ public protocol Executor: AnyObject, Sendable {
36
36
func enqueue( _ job: consuming ExecutorJob )
37
37
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
38
38
39
+ #if os(WASI) || !$Embedded
39
40
/// `true` if this is the main executor.
40
41
@available ( StdlibDeploymentTarget 6 . 2 , * )
41
42
var isMainExecutor : Bool { get }
43
+ #endif // os(WASI) || !$Embedded
42
44
}
43
45
44
46
@available ( StdlibDeploymentTarget 6 . 2 , * )
@@ -142,11 +144,12 @@ extension Executor where Self: Equatable {
142
144
}
143
145
144
146
extension Executor {
145
-
147
+ #if os(WASI) || !$Embedded
146
148
// This defaults to `false` so that existing third-party Executor
147
149
// implementations will work as expected.
148
150
@available ( StdlibDeploymentTarget 6 . 2 , * )
149
151
public var isMainExecutor : Bool { false }
152
+ #endif // os(WASI) || !$Embedded
150
153
151
154
}
152
155
@@ -364,10 +367,10 @@ public protocol SerialExecutor: Executor {
364
367
@available ( StdlibDeploymentTarget 6 . 0 , * )
365
368
extension SerialExecutor {
366
369
367
- #if ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
370
+ #if os(WASI) || (!$Embedded && ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
368
371
@available ( StdlibDeploymentTarget 6 . 2 , * )
369
372
public var isMainExecutor : Bool { return MainActor . executor. _isSameExecutor ( self ) }
370
- #endif
373
+ #endif // os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
371
374
372
375
@available ( StdlibDeploymentTarget 6 . 0 , * )
373
376
public func checkIsolated( ) {
@@ -575,9 +578,11 @@ public protocol MainExecutor: RunLoopExecutor, SerialExecutor {
575
578
/// executors.
576
579
@available ( StdlibDeploymentTarget 6 . 2 , * )
577
580
public protocol ExecutorFactory {
581
+ #if os(WASI) || !$Embedded
578
582
/// Constructs and returns the main executor, which is started implicitly
579
583
/// by the `async main` entry point and owns the "main" thread.
580
584
static var mainExecutor : any MainExecutor { get }
585
+ #endif // os(WASI) || !$Embedded
581
586
582
587
/// Constructs and returns the default or global executor, which is the
583
588
/// default place in which we run tasks.
@@ -590,9 +595,9 @@ typealias DefaultExecutorFactory = PlatformExecutorFactory
590
595
@available ( StdlibDeploymentTarget 6 . 2 , * )
591
596
@_silgen_name ( " swift_createExecutors " )
592
597
public func _createExecutors< F: ExecutorFactory > ( factory: F . Type ) {
593
- #if ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
598
+ #if os(WASI) || (!$Embedded && ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
594
599
MainActor . _executor = factory. mainExecutor
595
- #endif
600
+ #endif // os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
596
601
Task . _defaultExecutor = factory. defaultExecutor
597
602
}
598
603
0 commit comments