diff --git a/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift b/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift index aac68f50f..723622ac8 100644 --- a/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift +++ b/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift @@ -7,11 +7,11 @@ // import Foundation -import os +import Synchronization nonisolated public final class BinaryDiskCache: Sendable { public let folder: String - private let mutex = OSAllocatedUnfairLock(initialState: ()) + private let mutex = Mutex(()) public init(folder: String) { self.folder = folder diff --git a/Modules/RSCore/Sources/RSCore/Cache.swift b/Modules/RSCore/Sources/RSCore/Cache.swift index bf027497d..2b1baf913 100644 --- a/Modules/RSCore/Sources/RSCore/Cache.swift +++ b/Modules/RSCore/Sources/RSCore/Cache.swift @@ -6,7 +6,7 @@ // import Foundation -import os +import Synchronization public protocol CacheRecord: Sendable { var dateCreated: Date { get } @@ -21,7 +21,7 @@ public final class Cache: Sendable { var lastCleanupDate = Date() var cache = [String: T]() } - private let stateLock = OSAllocatedUnfairLock(initialState: State()) + private let stateLock = Mutex(State()) public init(timeToLive: TimeInterval, timeBetweenCleanups: TimeInterval) { self.timeToLive = timeToLive diff --git a/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift b/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift index 122107389..3b07e3f98 100644 --- a/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift +++ b/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift @@ -7,7 +7,7 @@ // import Foundation -import os +import Synchronization /// Code to be run by MainThreadOperationQueue on @MainActor. /// @@ -31,7 +31,7 @@ import os private struct State: Sendable { var isCanceled = false } - private let state = OSAllocatedUnfairLock(initialState: State()) + private let state = Mutex(State()) // Check this at appropriate times in case the operation has been canceled. nonisolated public var isCanceled: Bool {