Switch from OSAllocatedUnfairLock to Mutex in RSCore.

This commit is contained in:
Brent Simmons committed 2026-10-21 19:07:05 -07:00
1 parent c70a7ab4a7
commit 3baacbbad1
3 files changed
+6 -6

No files matched your search

@@ -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
+2 -2
View File
@@ -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<T: CacheRecord>: 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
@@ -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 {