mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 13:11:33 +00:00
implement infinite worlds with threaded chunk generation
This commit is contained in:
@ -62,6 +62,14 @@ public class ConcurrentDictionary<V: Hashable, T>: Collection {
|
||||
}
|
||||
}
|
||||
|
||||
public func take() -> Dictionary<V, T> {
|
||||
self.locked {
|
||||
let current = self.inner
|
||||
self.inner = [:]
|
||||
return current
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func locked<X>(_ perform: () -> X) -> X {
|
||||
self.lock.lock()
|
||||
defer {
|
||||
|
Reference in New Issue
Block a user