Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
#if canImport(Synchronization) && FOUNDATION_FRAMEWORK
internal import Synchronization
#endif

Expand All @@ -20,14 +20,14 @@ internal import Synchronization
struct LocaleNotifications : Sendable, ~Copyable {
static let cache = LocaleNotifications()

#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
#if canImport(Synchronization) && FOUNDATION_FRAMEWORK
let _count = Atomic<Int>(1)
#else
let _count = LockedState<Int>(initialState: 1)
#endif

func count() -> Int {
#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
#if canImport(Synchronization) && FOUNDATION_FRAMEWORK
_count.load(ordering: .relaxed)
#else
_count.withLock { $0 }
Expand All @@ -39,7 +39,7 @@ struct LocaleNotifications : Sendable, ~Copyable {
LocaleCache.cache.reset()
CalendarCache.cache.reset()
_ = TimeZoneCache.cache.reset()
#if canImport(Synchronization) && (!canImport(Darwin) || FOUNDATION_FRAMEWORK)
#if canImport(Synchronization) && FOUNDATION_FRAMEWORK
_count.add(1, ordering: .relaxed)
#else
_count.withLock { $0 += 1 }
Expand Down