Skip to content

Commit 9a141cb

Browse files
Gate the use of _runtime(_multithreaded) with compiler(>=6.1)
1 parent a05e798 commit 9a141cb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/JavaScriptKit/FundamentalObjects/JSObject.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class JSObject: Equatable {
2929
@_spi(JSObject_id)
3030
public var id: JavaScriptObjectRef
3131

32-
#if _runtime(_multithreaded)
32+
#if compiler(>=6.1) && _runtime(_multithreaded)
3333
private let ownerThread: pthread_t
3434
#endif
3535

@@ -47,14 +47,14 @@ public class JSObject: Equatable {
4747
/// is a programmer error and will result in a runtime assertion failure because JavaScript
4848
/// object spaces are not shared across threads backed by Web Workers.
4949
private func assertOnOwnerThread(hint: @autoclosure () -> String) {
50-
#if _runtime(_multithreaded)
50+
#if compiler(>=6.1) && _runtime(_multithreaded)
5151
precondition(pthread_equal(ownerThread, pthread_self()) != 0, "JSObject is being accessed from a thread other than the owner thread: \(hint())")
5252
#endif
5353
}
5454

5555
/// Asserts that the two objects being compared are owned by the same thread.
5656
private static func assertSameOwnerThread(lhs: JSObject, rhs: JSObject, hint: @autoclosure () -> String) {
57-
#if _runtime(_multithreaded)
57+
#if compiler(>=6.1) && _runtime(_multithreaded)
5858
precondition(pthread_equal(lhs.ownerThread, rhs.ownerThread) != 0, "JSObject is being accessed from a thread other than the owner thread: \(hint())")
5959
#endif
6060
}
@@ -206,7 +206,7 @@ public class JSObject: Equatable {
206206

207207
// `JSObject` storage itself is immutable, and use of `JSObject.global` from other
208208
// threads maintains the same semantics as `globalThis` in JavaScript.
209-
#if _runtime(_multithreaded)
209+
#if compiler(>=6.1) && _runtime(_multithreaded)
210210
@LazyThreadLocal(initialize: {
211211
return JSObject(id: _JS_Predef_Value_Global)
212212
})

Sources/JavaScriptKit/ThreadLocal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if _runtime(_multithreaded)
1+
#if compiler(>=6.1) && _runtime(_multithreaded)
22
#if canImport(wasi_pthread)
33
import wasi_pthread
44
#elseif canImport(Darwin)

0 commit comments

Comments
 (0)