Renamed VoxelFileLocker => FileLocker and namespaced

This commit is contained in:
Marc Gilleron 2021-12-29 19:22:59 +00:00
parent 0be0fb19b0
commit 66fb239d80
2 changed files with 8 additions and 5 deletions

View File

@ -154,7 +154,7 @@ public:
void process();
void wait_and_clear_all_tasks(bool warn);
inline VoxelFileLocker &get_file_locker() {
inline zylann::FileLocker &get_file_locker() {
return _file_locker;
}
@ -379,7 +379,7 @@ private:
int _main_thread_time_budget_usec = 8000;
zylann::ProgressiveTaskRunner _progressive_task_runner;
VoxelFileLocker _file_locker;
zylann::FileLocker _file_locker;
};
// TODO Hack to make VoxelServer update... need ways to integrate callbacks from main loop!

View File

@ -6,12 +6,13 @@
#include <core/os/rw_lock.h>
#include <core/templates/hash_map.h>
namespace zylann {
// Performs software locking on paths,
// so that multiple threads (controlled by this module) wanting to access the same file will lock a shared mutex.
// Note: has nothing to do with voxels, it's just prefixed.
class VoxelFileLocker {
class FileLocker {
public:
~VoxelFileLocker() {
~FileLocker() {
const String *key = nullptr;
while ((key = _files.next(key))) {
File *f = _files[*key];
@ -90,4 +91,6 @@ private:
HashMap<String, File *> _files;
};
} // namespace zylann
#endif // VOXEL_FILE_LOCKER_H