A lot of changes in almost all files

This commit is contained in:
MihailRis
2022-02-28 02:30:15 +03:00
committed by GitHub
parent cd3e737385
commit bc9d29cf68
28 changed files with 3485 additions and 476 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef VOXELS_CHUNKSLOADER_H_
#define VOXELS_CHUNKSLOADER_H_
#include <thread>
#include <atomic>
class Chunk;
class ChunksLoader final {
private:
std::thread loaderThread;
void _thread();
std::atomic<Chunk*> current {nullptr};
std::atomic<Chunk**> closes {nullptr};
std::atomic<bool> working {true};
public:
ChunksLoader() : loaderThread{} {
loaderThread = std::thread{&ChunksLoader::_thread, this};
}
~ChunksLoader(){
working = false;
loaderThread.join();
}
bool isBusy(){
return current != nullptr;
}
void perform(Chunk* chunk, const Chunk** closes);
void stop(){
working = false;
}
};
#endif /* VOXELS_CHUNKSLOADER_H_ */