fix: check if threads are started before waiting
This commit is contained in:
parent
0f5539ebc0
commit
e2207eec68
1 changed files with 6 additions and 2 deletions
|
|
@ -75,7 +75,9 @@ void Terrain::_notification(int what) {
|
||||||
this->threads_stop = true;
|
this->threads_stop = true;
|
||||||
this->workload_lock.unlock();
|
this->workload_lock.unlock();
|
||||||
for (Thread &thread : this->threads) {
|
for (Thread &thread : this->threads) {
|
||||||
thread.wait_to_finish();
|
if (thread.is_started()) {
|
||||||
|
thread.wait_to_finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +117,9 @@ void Terrain::construct_chunk_grid() {
|
||||||
this->threads_stop = true;
|
this->threads_stop = true;
|
||||||
this->workload_lock.unlock();
|
this->workload_lock.unlock();
|
||||||
for (Thread &thread : this->threads) {
|
for (Thread &thread : this->threads) {
|
||||||
thread.wait_to_finish();
|
if (thread.is_started()) {
|
||||||
|
thread.wait_to_finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this->workload_lock.lock();
|
this->workload_lock.lock();
|
||||||
for (TerrainChunkMesh *mesh : this->meshes) {
|
for (TerrainChunkMesh *mesh : this->meshes) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue