Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Nov 27, 2024
1 parent 356f96a commit a207fd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/PerceptionCore/Internal/ThreadLocal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct _ThreadLocal {
get { _value.value }
set { _value.value = newValue }
}
private let _value = UncheckedSendable<UnsafeMutableRawPointer?>(nil)
private static let _value = UncheckedBox<UnsafeMutableRawPointer?>(nil)
#else
static var value: UnsafeMutableRawPointer? {
get { Thread.current.threadDictionary[Key()] as! UnsafeMutableRawPointer? }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@usableFromInline final class UncheckedBox<Value>: @unchecked Sendable {
@usableFromInline var value: Value
@usableFromInline init(_ value: Value) {
self.value = value
}
}
@usableFromInline struct UncheckedSendable<Value>: @unchecked Sendable {
@usableFromInline let value: Value
@usableFromInline init(_ value: Value) {
Expand Down

0 comments on commit a207fd1

Please sign in to comment.