@@ -36,6 +36,7 @@ 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 !$Embedded
39
40
// The functions below could have been added to a separate protocol,
40
41
// but doing that would then mean doing an `as?` cast in e.g.
41
42
// enqueueOnGlobalExecutor (in ExecutorBridge.swift), which is
@@ -44,6 +45,7 @@ public protocol Executor: AnyObject, Sendable {
44
45
/// `true` if this is the main executor.
45
46
@available ( SwiftStdlib 6 . 2 , * )
46
47
var isMainExecutor : Bool { get }
48
+ #endif
47
49
48
50
/// `true` if this Executor supports scheduling.
49
51
///
@@ -116,10 +118,12 @@ extension Executor where Self: Equatable {
116
118
// Delay support
117
119
extension Executor {
118
120
121
+ #if !$Embedded
119
122
// This defaults to `false` so that existing third-party Executor
120
123
// implementations will work as expected.
121
124
@available ( SwiftStdlib 6 . 2 , * )
122
125
public var isMainExecutor : Bool { false }
126
+ #endif
123
127
124
128
// This defaults to `false` so that existing third-party TaskExecutor
125
129
// implementations will work as expected.
@@ -327,8 +331,10 @@ public protocol SerialExecutor: Executor {
327
331
@available ( SwiftStdlib 6 . 0 , * )
328
332
extension SerialExecutor {
329
333
334
+ #if !$Embedded
330
335
@available ( SwiftStdlib 6 . 2 , * )
331
336
public var isMainExecutor : Bool { return MainActor . executor. _isSameExecutor ( self ) }
337
+ #endif
332
338
333
339
@available ( SwiftStdlib 6 . 0 , * )
334
340
public func checkIsolated( ) {
@@ -578,9 +584,11 @@ public protocol MainExecutor: RunLoopExecutor, SerialExecutor, EventableExecutor
578
584
/// executors.
579
585
@available ( SwiftStdlib 6 . 2 , * )
580
586
public protocol ExecutorFactory {
587
+ #if !$Embedded
581
588
/// Constructs and returns the main executor, which is started implicitly
582
589
/// by the `async main` entry point and owns the "main" thread.
583
590
static var mainExecutor : any MainExecutor { get }
591
+ #endif
584
592
585
593
/// Constructs and returns the default or global executor, which is the
586
594
/// default place in which we run tasks.
@@ -590,10 +598,13 @@ public protocol ExecutorFactory {
590
598
@available ( SwiftStdlib 6 . 2 , * )
591
599
@_silgen_name ( " swift_createExecutors " )
592
600
public func _createExecutors< F: ExecutorFactory > ( factory: F . Type ) {
601
+ #if !$Embedded
593
602
MainActor . _executor = factory. mainExecutor
603
+ #endif
594
604
Task . _defaultExecutor = factory. defaultExecutor
595
605
}
596
606
607
+ #if !$Embedded
597
608
extension MainActor {
598
609
@available ( SwiftStdlib 6 . 2 , * )
599
610
static var _executor : ( any MainExecutor ) ? = nil
@@ -611,6 +622,7 @@ extension MainActor {
611
622
return _executor!
612
623
}
613
624
}
625
+ #endif // !$Embedded
614
626
615
627
extension Task where Success == Never , Failure == Never {
616
628
@available ( SwiftStdlib 6 . 2 , * )
0 commit comments