Merge pull request #3111 from heckj/unsafe_os_unfair_lock
replacing os_unfair_lock with NSLock
This commit is contained in:
commit
a6a641d1c5
|
@ -14,12 +14,11 @@ import RSCore
|
||||||
// * Collisions aren’t going to happen with feed data
|
// * Collisions aren’t going to happen with feed data
|
||||||
|
|
||||||
private var databaseIDCache = [String: String]()
|
private var databaseIDCache = [String: String]()
|
||||||
private var databaseIDCacheLock = os_unfair_lock_s()
|
private var databaseIDCacheLock = NSLock()
|
||||||
|
|
||||||
public func databaseIDWithString(_ s: String) -> String {
|
public func databaseIDWithString(_ s: String) -> String {
|
||||||
os_unfair_lock_lock(&databaseIDCacheLock)
|
databaseIdCacheLock.lock()
|
||||||
defer {
|
defer {
|
||||||
os_unfair_lock_unlock(&databaseIDCacheLock)
|
databaseIdCacheLock.unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
if let identifier = databaseIDCache[s] {
|
if let identifier = databaseIDCache[s] {
|
||||||
|
|
Loading…
Reference in New Issue