File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Sources/JavaScriptEventLoop Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1- #if compiler(>=6.1) && _runtime(_multithreaded) // @_expose and @_extern are only available in Swift 6.0 +
1+ #if compiler(>=6.1) && _runtime(_multithreaded) // @_expose and @_extern are only available in Swift 6.1 +
22
33import JavaScriptKit
44import _CJavaScriptKit
@@ -274,6 +274,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
274274 }
275275
276276 func start( timeout: Duration , checkInterval: Duration ) async throws {
277+ #if canImport(wasi_pthread)
277278 class Context : @unchecked Sendable {
278279 let executor : WebWorkerTaskExecutor . Executor
279280 let worker : Worker
@@ -316,6 +317,9 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
316317 } while tid == 0
317318 swjs_listen_message_from_worker_thread ( tid)
318319 }
320+ #else
321+ fatalError ( " Unsupported platform " )
322+ #endif
319323 }
320324
321325 func terminate( ) {
@@ -420,6 +424,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
420424 ///
421425 /// This function must be called once before using the Web Worker task executor.
422426 public static func installGlobalExecutor( ) {
427+ #if canImport(wasi_pthread)
423428 // Ensure this function is called only once.
424429 guard _mainThread == nil else { return }
425430
@@ -448,6 +453,9 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
448453 }
449454 }
450455 swift_task_enqueueGlobal_hook = unsafeBitCast ( swift_task_enqueueGlobal_hook_impl, to: UnsafeMutableRawPointer ? . self)
456+ #else
457+ fatalError ( " Unsupported platform " )
458+ #endif
451459 }
452460}
453461
You can’t perform that action at this time.
0 commit comments