Fixed race condition with soft_stop and onTick
This commit is contained in:
parent
faecf408d6
commit
893aef7c42
1 changed files with 8 additions and 6 deletions
|
@ -218,11 +218,13 @@ void Workers::soft_stop() // stop current workers leaving uv stuff intact (used
|
||||||
m_sequence = 0;
|
m_sequence = 0;
|
||||||
m_paused = 0;
|
m_paused = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_workers.size(); ++i) {
|
std::vector<Handle*> Workers::old_workers = m_workers;
|
||||||
m_workers[i]->join();
|
|
||||||
delete m_workers[i];
|
|
||||||
}
|
|
||||||
m_workers.clear();
|
m_workers.clear();
|
||||||
|
|
||||||
|
for (Handle *handle : old_workers) {
|
||||||
|
handle->join();
|
||||||
|
delete handle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setups workers based on specified algorithm (or its basic perf algo more specifically)
|
// setups workers based on specified algorithm (or its basic perf algo more specifically)
|
||||||
|
@ -281,8 +283,8 @@ void Workers::stop()
|
||||||
m_paused = 0;
|
m_paused = 0;
|
||||||
m_sequence = 0;
|
m_sequence = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_workers.size(); ++i) {
|
for (Handle *handle : m_workers) {
|
||||||
m_workers[i]->join();
|
handle->join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue