@@ -2,10 +2,7 @@ import JavaScriptKit
22import _Concurrency
33import _CJavaScriptEventLoop
44import _CJavaScriptKit
5-
6- #if hasFeature(Embedded)
75import Synchronization
8- #endif
96
107// NOTE: `@available` annotations are semantically wrong, but they make it easier to develop applications targeting WebAssembly in Xcode.
118
@@ -109,39 +106,21 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
109106 return eventLoop
110107 }
111108
112- #if !hasFeature(Embedded)
113- @MainActor
114- private static var didInstallGlobalExecutor = false
115- #else
116109 private static let didInstallGlobalExecutor = Atomic < Bool > ( false )
117- #endif
118110
119111 /// Set JavaScript event loop based executor to be the global executor
120112 /// Note that this should be called before any of the jobs are created.
121113 /// This installation step will be unnecessary after custom executor are
122114 /// introduced officially. See also [a draft proposal for custom
123115 /// executors](https://github.com/rjmccall/swift-evolution/blob/custom-executors/proposals/0000-custom-executors.md#the-default-global-concurrent-executor)
124116 public static func installGlobalExecutor( ) {
125- #if !hasFeature(Embedded)
126- MainActor . assumeIsolated {
127- Self . installGlobalExecutorIsolated ( )
128- }
129- #else
130117 Self . installGlobalExecutorIsolated ( )
131- #endif
132118 }
133119
134- #if !hasFeature(Embedded)
135- @MainActor
136- #endif
137120 private static func installGlobalExecutorIsolated( ) {
138- #if !hasFeature(Embedded)
139- guard !didInstallGlobalExecutor else { return }
140- #else
141121 guard !didInstallGlobalExecutor. load ( ordering: . sequentiallyConsistent) else {
142122 return
143123 }
144- #endif
145124
146125 #if compiler(>=5.9)
147126 typealias swift_task_asyncMainDrainQueue_hook_Fn = @convention ( thin) (
@@ -211,11 +190,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
211190 to: UnsafeMutableRawPointer ? . self
212191 )
213192
214- #if !hasFeature(Embedded)
215- didInstallGlobalExecutor = true
216- #else
217193 didInstallGlobalExecutor. store ( true , ordering: . sequentiallyConsistent)
218- #endif
219194 }
220195
221196 private func enqueue( _ job: UnownedJob , withDelay nanoseconds: UInt64 ) {
0 commit comments