Spatial Chunk Generation

This commit is contained in:
Alex Zenla
2024-09-07 02:38:54 -04:00
parent 76b61c49ae
commit f2b3b07832
4 changed files with 101 additions and 9 deletions

View File

@ -75,6 +75,18 @@ public class ConcurrentDictionary<V: Hashable, T>: Collection {
self.inner.removeAll(keepingCapacity: keep)
}
}
@discardableResult public func remove(key: V) -> T? {
self.locked {
self.inner.removeValue(forKey: key)
}
}
public func with(_ perform: (inout [V : T]) -> Void) {
self.locked {
perform(&self.inner)
}
}
fileprivate func locked<X>(_ perform: () -> X) -> X {
self.lock.lock()