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

ClientProcess fix

This commit is contained in:
Jack Andersen
2016-04-15 10:42:19 -10:00
parent 037404c5ff
commit 88276db37f
5 changed files with 7 additions and 8 deletions

View File

@@ -71,11 +71,13 @@ void ClientProcess::Worker::proc()
while (m_proc.m_pendingQueue.size())
{
std::unique_ptr<Transaction> trans = std::move(m_proc.m_pendingQueue.front());
++m_proc.m_inProgress;
m_proc.m_pendingQueue.pop_front();
lk.unlock();
trans->run(m_blendTok);
lk.lock();
m_proc.m_completedQueue.push_back(std::move(trans));
m_proc.m_pendingQueue.pop_front();
--m_proc.m_inProgress;
}
m_proc.m_waitCv.notify_one();
if (!m_proc.m_running)
@@ -158,7 +160,7 @@ void ClientProcess::swapCompletedQueue(std::list<std::unique_ptr<Transaction>>&
void ClientProcess::waitUntilComplete()
{
std::unique_lock<std::mutex> lk(m_mutex);
while (m_pendingQueue.size())
while (m_pendingQueue.size() || m_inProgress)
m_waitCv.wait(lk);
}