mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-27 17:29:20 +01:00
Merge pull request #3111 from heckj/unsafe_os_unfair_lock
replacing os_unfair_lock with NSLock
This commit is contained in:
commit
a6a641d1c5
@ -14,13 +14,12 @@ import RSCore
|
||||
// * Collisions aren’t going to happen with feed data
|
||||
|
||||
private var databaseIDCache = [String: String]()
|
||||
private var databaseIDCacheLock = os_unfair_lock_s()
|
||||
|
||||
private var databaseIDCacheLock = NSLock()
|
||||
public func databaseIDWithString(_ s: String) -> String {
|
||||
os_unfair_lock_lock(&databaseIDCacheLock)
|
||||
defer {
|
||||
os_unfair_lock_unlock(&databaseIDCacheLock)
|
||||
}
|
||||
databaseIdCacheLock.lock()
|
||||
defer {
|
||||
databaseIdCacheLock.unlock()
|
||||
}
|
||||
|
||||
if let identifier = databaseIDCache[s] {
|
||||
return identifier
|
||||
|
Loading…
x
Reference in New Issue
Block a user