2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:07:42 +00:00

Another race condition fix

This commit is contained in:
Jack Andersen
2016-04-09 13:18:12 -10:00
parent 5fc5442286
commit 6945ec94b8
2 changed files with 10 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ void ClientProcess::Worker::proc()
lk.lock();
m_proc.m_completedQueue.push_back(std::move(trans));
}
m_proc.m_waitCv.notify_one();
if (!m_proc.m_running)
break;
m_proc.m_cv.wait(lk);
@@ -154,6 +155,13 @@ void ClientProcess::swapCompletedQueue(std::list<std::unique_ptr<Transaction>>&
queue.swap(m_completedQueue);
}
void ClientProcess::waitUntilComplete()
{
std::unique_lock<std::mutex> lk(m_mutex);
while (m_pendingQueue.size())
m_waitCv.wait(lk);
}
void ClientProcess::shutdown()
{
if (!m_running)