Skip to content

Commit

Permalink
Merge pull request #261 from swiftwasm/yt/xcode16
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun authored Sep 26, 2024
2 parents 9229214 + ba37ea4 commit 9328d4b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ jobs:
strategy:
matrix:
include:
- os: macos-13
xcode: Xcode_14.3
- os: macos-14
xcode: Xcode_15.2
- os: macos-15
xcode: Xcode_16
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
return _shared
}

#if compiler(>=6.0) && hasFeature(IsolatedAny2) && _runtime(_multithreaded)
#if compiler(>=6.1) && _runtime(_multithreaded)
// In multi-threaded environment, we have an event loop executor per
// thread (per Web Worker). A job enqueued in one thread should be
// executed in the same thread under this global executor.
Expand Down
10 changes: 9 additions & 1 deletion Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if compiler(>=6.0) && hasFeature(IsolatedAny2) && _runtime(_multithreaded) // @_expose and @_extern are only available in Swift 6.0+
#if compiler(>=6.1) && _runtime(_multithreaded) // @_expose and @_extern are only available in Swift 6.1+

import JavaScriptKit
import _CJavaScriptKit
Expand Down Expand Up @@ -274,6 +274,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
}

func start(timeout: Duration, checkInterval: Duration) async throws {
#if canImport(wasi_pthread)
class Context: @unchecked Sendable {
let executor: WebWorkerTaskExecutor.Executor
let worker: Worker
Expand Down Expand Up @@ -316,6 +317,9 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
} while tid == 0
swjs_listen_message_from_worker_thread(tid)
}
#else
fatalError("Unsupported platform")
#endif
}

func terminate() {
Expand Down Expand Up @@ -420,6 +424,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
///
/// This function must be called once before using the Web Worker task executor.
public static func installGlobalExecutor() {
#if canImport(wasi_pthread)
// Ensure this function is called only once.
guard _mainThread == nil else { return }

Expand Down Expand Up @@ -448,6 +453,9 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
}
}
swift_task_enqueueGlobal_hook = unsafeBitCast(swift_task_enqueueGlobal_hook_impl, to: UnsafeMutableRawPointer?.self)
#else
fatalError("Unsupported platform")
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if compiler(>=6.0) && hasFeature(IsolatedAny2) && _runtime(_multithreaded)
#if compiler(>=6.1) && _runtime(_multithreaded)
import XCTest
import JavaScriptKit
import _CJavaScriptKit // For swjs_get_worker_thread_id
Expand Down

0 comments on commit 9328d4b

Please sign in to comment.