mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 10:47:21 +00:00
Switch from OSAllocatedUnfairLock to Mutex in RSCore.
This commit is contained in:
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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user