Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed May 28, 2024
1 parent 1cdbc76 commit d8a1fa8
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions Sources/Perception/Internal/ThreadLocal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@

import Foundation

@_silgen_name("_swift_observation_tls_get")
func _tlsGet() -> UnsafeMutableRawPointer?

@_silgen_name("_swift_observation_tls_set")
func _tlsSet(_ value: UnsafeMutableRawPointer?)

struct _ThreadLocal {
static var value: UnsafeMutableRawPointer? {
get {
_tlsGet()
}
set {
_tlsSet(newValue)
#if os(WASI)
static var value: UnsafeMutableRawPointer?
#else
static var value: UnsafeMutableRawPointer? {
get { Thread.current.threadDictionary[Key()] as! UnsafeMutableRawPointer? }
set { Thread.current.threadDictionary[Key()] = newValue }
}
}
private struct Key: Hashable {}
#endif
}

0 comments on commit d8a1fa8

Please sign in to comment.