@@ -36,9 +36,11 @@ public protocol Executor: AnyObject, Sendable {
3636 func enqueue( _ job: consuming ExecutorJob )
3737 #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
3838
39+ #if os(WASI) || !$Embedded
3940 /// `true` if this is the main executor.
4041 @available ( StdlibDeploymentTarget 6 . 2 , * )
4142 var isMainExecutor : Bool { get }
43+ #endif // os(WASI) || !$Embedded
4244}
4345
4446@available ( StdlibDeploymentTarget 6 . 2 , * )
@@ -142,11 +144,12 @@ extension Executor where Self: Equatable {
142144}
143145
144146extension Executor {
145-
147+ #if os(WASI) || !$Embedded
146148 // This defaults to `false` so that existing third-party Executor
147149 // implementations will work as expected.
148150 @available ( StdlibDeploymentTarget 6 . 2 , * )
149151 public var isMainExecutor : Bool { false }
152+ #endif // os(WASI) || !$Embedded
150153
151154}
152155
@@ -364,10 +367,10 @@ public protocol SerialExecutor: Executor {
364367@available ( StdlibDeploymentTarget 6 . 0 , * )
365368extension SerialExecutor {
366369
367- #if ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
370+ #if os(WASI) || (!$Embedded && ! SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
368371 @available ( StdlibDeploymentTarget 6 . 2 , * )
369372 public var isMainExecutor : Bool { return MainActor . executor. _isSameExecutor ( self ) }
370- #endif
373+ #endif // os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
371374
372375 @available ( StdlibDeploymentTarget 6 . 0 , * )
373376 public func checkIsolated( ) {
@@ -575,9 +578,11 @@ public protocol MainExecutor: RunLoopExecutor, SerialExecutor {
575578/// executors.
576579@available ( StdlibDeploymentTarget 6 . 2 , * )
577580public protocol ExecutorFactory {
581+ #if os(WASI) || !$Embedded
578582 /// Constructs and returns the main executor, which is started implicitly
579583 /// by the `async main` entry point and owns the "main" thread.
580584 static var mainExecutor : any MainExecutor { get }
585+ #endif // os(WASI) || !$Embedded
581586
582587 /// Constructs and returns the default or global executor, which is the
583588 /// default place in which we run tasks.
@@ -590,9 +595,9 @@ typealias DefaultExecutorFactory = PlatformExecutorFactory
590595@available ( StdlibDeploymentTarget 6 . 2 , * )
591596@_silgen_name ( " swift_createExecutors " )
592597public 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)
594599 MainActor . _executor = factory. mainExecutor
595- #endif
600+ #endif // os(WASI) || (!$Embedded && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
596601 Task . _defaultExecutor = factory. defaultExecutor
597602}
598603
0 commit comments