Files
goose/api_clients/swift/GooseAPI/Classes/OpenAPIs/SynchronizedDictionary.swift
2025-10-02 20:13:20 -04:00

27 lines
563 B
Swift

// SynchronizedDictionary.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
internal struct SynchronizedDictionary<K: Hashable, V> {
private var dictionary = [K: V]()
private let lock = NSRecursiveLock()
internal subscript(key: K) -> V? {
get {
lock.lock()
defer { lock.unlock() }
return self.dictionary[key]
}
set {
lock.lock()
defer { lock.unlock() }
self.dictionary[key] = newValue
}
}
}