File tree 1 file changed +9
-1
lines changed
Sources/JavaScriptEventLoop
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 +
2
2
3
3
import JavaScriptKit
4
4
import _CJavaScriptKit
@@ -274,6 +274,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
274
274
}
275
275
276
276
func start( timeout: Duration , checkInterval: Duration ) async throws {
277
+ #if canImport(wasi_pthread)
277
278
class Context : @unchecked Sendable {
278
279
let executor : WebWorkerTaskExecutor . Executor
279
280
let worker : Worker
@@ -316,6 +317,9 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
316
317
} while tid == 0
317
318
swjs_listen_message_from_worker_thread ( tid)
318
319
}
320
+ #else
321
+ fatalError ( " Unsupported platform " )
322
+ #endif
319
323
}
320
324
321
325
func terminate( ) {
@@ -420,6 +424,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
420
424
///
421
425
/// This function must be called once before using the Web Worker task executor.
422
426
public static func installGlobalExecutor( ) {
427
+ #if canImport(wasi_pthread)
423
428
// Ensure this function is called only once.
424
429
guard _mainThread == nil else { return }
425
430
@@ -448,6 +453,9 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
448
453
}
449
454
}
450
455
swift_task_enqueueGlobal_hook = unsafeBitCast ( swift_task_enqueueGlobal_hook_impl, to: UnsafeMutableRawPointer ? . self)
456
+ #else
457
+ fatalError ( " Unsupported platform " )
458
+ #endif
451
459
}
452
460
}
453
461
You can’t perform that action at this time.
0 commit comments