@@ -2,7 +2,6 @@ import JavaScriptKit
22import _Concurrency
33import _CJavaScriptEventLoop
44import _CJavaScriptKit
5- import Synchronization
65
76// NOTE: `@available` annotations are semantically wrong, but they make it easier to develop applications targeting WebAssembly in Xcode.
87
@@ -106,7 +105,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
106105 return eventLoop
107106 }
108107
109- private static let didInstallGlobalExecutor = Atomic < Bool > ( false )
108+ private nonisolated ( unsafe ) static var didInstallGlobalExecutor = false
110109
111110 /// Set JavaScript event loop based executor to be the global executor
112111 /// Note that this should be called before any of the jobs are created.
@@ -118,9 +117,8 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
118117 }
119118
120119 private static func installGlobalExecutorIsolated( ) {
121- guard !didInstallGlobalExecutor. load ( ordering: . sequentiallyConsistent) else {
122- return
123- }
120+ guard !didInstallGlobalExecutor else { return }
121+ didInstallGlobalExecutor = true
124122
125123 #if compiler(>=5.9)
126124 typealias swift_task_asyncMainDrainQueue_hook_Fn = @convention ( thin) (
@@ -189,8 +187,6 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
189187 swift_task_enqueueMainExecutor_hook_impl,
190188 to: UnsafeMutableRawPointer ? . self
191189 )
192-
193- didInstallGlobalExecutor. store ( true , ordering: . sequentiallyConsistent)
194190 }
195191
196192 private func enqueue( _ job: UnownedJob , withDelay nanoseconds: UInt64 ) {
0 commit comments