@@ -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.
@@ -324,8 +328,10 @@ public protocol SerialExecutor: Executor {
324
328
@available ( SwiftStdlib 6 . 0 , * )
325
329
extension SerialExecutor {
326
330
331
+ #if !$Embedded
327
332
@available ( SwiftStdlib 6 . 2 , * )
328
333
public var isMainExecutor : Bool { return MainActor . executor. _isSameExecutor ( self ) }
334
+ #endif
329
335
330
336
@available ( SwiftStdlib 6 . 0 , * )
331
337
public func checkIsolated( ) {
@@ -565,9 +571,11 @@ public protocol MainExecutor: RunLoopExecutor, SerialExecutor, EventableExecutor
565
571
/// executors.
566
572
@available ( SwiftStdlib 6 . 2 , * )
567
573
public protocol ExecutorFactory {
574
+ #if !$Embedded
568
575
/// Constructs and returns the main executor, which is started implicitly
569
576
/// by the `async main` entry point and owns the "main" thread.
570
577
static var mainExecutor : any MainExecutor { get }
578
+ #endif
571
579
572
580
/// Constructs and returns the default or global executor, which is the
573
581
/// default place in which we run tasks.
@@ -577,10 +585,13 @@ public protocol ExecutorFactory {
577
585
@available ( SwiftStdlib 6 . 2 , * )
578
586
@_silgen_name ( " swift_createExecutors " )
579
587
public func _createExecutors< F: ExecutorFactory > ( factory: F . Type ) {
588
+ #if !$Embedded
580
589
MainActor . _executor = factory. mainExecutor
590
+ #endif
581
591
Task . _defaultExecutor = factory. defaultExecutor
582
592
}
583
593
594
+ #if !$Embedded
584
595
extension MainActor {
585
596
@available ( SwiftStdlib 6 . 2 , * )
586
597
static var _executor : ( any MainExecutor ) ? = nil
@@ -598,6 +609,7 @@ extension MainActor {
598
609
return _executor!
599
610
}
600
611
}
612
+ #endif // !$Embedded
601
613
602
614
extension Task where Success == Never , Failure == Never {
603
615
@available ( SwiftStdlib 6 . 2 , * )
0 commit comments