From 7b054fdf873dd441e064002f78e3cedac92f5d46 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 30 Aug 2025 23:43:20 +0800 Subject: [PATCH] Make _ThreadLocal.value public under OpenSwiftUI SPI Expose the value property of _ThreadLocal as public API under the OpenSwiftUI SPI to allow access from the OpenSwiftUI framework while keeping it hidden from general public API. --- Sources/OpenObservation/ThreadLocal.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/OpenObservation/ThreadLocal.swift b/Sources/OpenObservation/ThreadLocal.swift index 21a41a6..ed23d36 100644 --- a/Sources/OpenObservation/ThreadLocal.swift +++ b/Sources/OpenObservation/ThreadLocal.swift @@ -18,8 +18,9 @@ func _tlsGet() -> UnsafeMutableRawPointer? @_silgen_name("_swift_openobservation_tls_set") func _tlsSet(_ value: UnsafeMutableRawPointer?) -struct _ThreadLocal { - static var value: UnsafeMutableRawPointer? { +@_spi(OpenSwiftUI) +public struct _ThreadLocal { + public static var value: UnsafeMutableRawPointer? { get { return _tlsGet() } @@ -46,8 +47,9 @@ import Bionic #error("Unsupported platform") #endif -struct _ThreadLocal { - static var value: UnsafeMutableRawPointer? { +@_spi(OpenSwiftUI) +public struct _ThreadLocal { + public static var value: UnsafeMutableRawPointer? { get { #if canImport(Darwin) return pthread_getspecific(key.key)