Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use compiler(>=6.1) to gate for the main branch toolchain #261

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading