@@ -2,7 +2,6 @@ import JavaScriptKit
2
2
import _Concurrency
3
3
import _CJavaScriptEventLoop
4
4
import _CJavaScriptKit
5
- import Synchronization
6
5
7
6
// NOTE: `@available` annotations are semantically wrong, but they make it easier to develop applications targeting WebAssembly in Xcode.
8
7
@@ -106,7 +105,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
106
105
return eventLoop
107
106
}
108
107
109
- private static let didInstallGlobalExecutor = Atomic < Bool > ( false )
108
+ private nonisolated ( unsafe ) static var didInstallGlobalExecutor = false
110
109
111
110
/// Set JavaScript event loop based executor to be the global executor
112
111
/// Note that this should be called before any of the jobs are created.
@@ -118,9 +117,8 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
118
117
}
119
118
120
119
private static func installGlobalExecutorIsolated( ) {
121
- guard !didInstallGlobalExecutor. load ( ordering: . sequentiallyConsistent) else {
122
- return
123
- }
120
+ guard !didInstallGlobalExecutor else { return }
121
+ didInstallGlobalExecutor = true
124
122
125
123
#if compiler(>=5.9)
126
124
typealias swift_task_asyncMainDrainQueue_hook_Fn = @convention ( thin) (
@@ -189,8 +187,6 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
189
187
swift_task_enqueueMainExecutor_hook_impl,
190
188
to: UnsafeMutableRawPointer ? . self
191
189
)
192
-
193
- didInstallGlobalExecutor. store ( true , ordering: . sequentiallyConsistent)
194
190
}
195
191
196
192
private func enqueue( _ job: UnownedJob , withDelay nanoseconds: UInt64 ) {
0 commit comments