useRegFile fix
This commit is contained in:
parent
adf54b8a38
commit
ab110dcdf5
@ -205,6 +205,8 @@ ubyte* WorldRegions::getData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<regfile> WorldRegions::useRegFile(glm::ivec3 coord) {
|
std::shared_ptr<regfile> WorldRegions::useRegFile(glm::ivec3 coord) {
|
||||||
|
auto* file = openRegFiles[coord].get();
|
||||||
|
file->inUse = true;
|
||||||
return std::shared_ptr<regfile>(openRegFiles[coord].get(), [this](regfile* ptr) {
|
return std::shared_ptr<regfile>(openRegFiles[coord].get(), [this](regfile* ptr) {
|
||||||
ptr->inUse = false;
|
ptr->inUse = false;
|
||||||
regFilesCv.notify_one();
|
regFilesCv.notify_one();
|
||||||
@ -225,7 +227,6 @@ std::shared_ptr<regfile> WorldRegions::getRegFile(glm::ivec3 coord) {
|
|||||||
if (found->second->inUse) {
|
if (found->second->inUse) {
|
||||||
throw std::runtime_error("regfile is currently in use");
|
throw std::runtime_error("regfile is currently in use");
|
||||||
}
|
}
|
||||||
found->second->inUse = true;
|
|
||||||
return useRegFile(found->first);
|
return useRegFile(found->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user