More threadpool bs

This commit is contained in:
Dynamitos
2021-12-02 13:00:03 +01:00
parent 5fafdda770
commit 9e3a2446ce
37 changed files with 488 additions and 541 deletions
-15
View File
@@ -35,24 +35,9 @@ public:
{
std::unique_lock lck(lock);
this->status = status;
if(status == Status::Ready)
{
readyCV.notify_all();
}
}
protected:
inline void waitReady()
{
std::unique_lock lck(lock);
if(status != Status::Ready)
{
std::cout << "Asset " << name.generic_string() << " not ready yet, waiting" << std::endl;
readyCV.wait(lck);
std::cout << "Asset " << name.generic_string() << " now ready, continuing" << std::endl;
}
}
std::mutex lock;
std::condition_variable readyCV;
std::ifstream& getReadStream();
std::ofstream& getWriteStream();
private:
+1 -1
View File
@@ -43,6 +43,6 @@ void MeshAsset::addMesh(PMesh mesh)
const Array<PMesh> MeshAsset::getMeshes()
{
waitReady();
std::unique_lock lck(lock);
return meshes;
}