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

@ -5,10 +5,6 @@ if(MSVC)
# Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244)
else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
message(WARNING "GCC needs -fpermissive for nested type redeclarations; expect lotsa warnings!!")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
endif()
endif()

2
hecl/extern/athena vendored

@ -1 +1 @@
Subproject commit d2fb800b926c9d4ef76e54242c54f3fe369f7c3d
Subproject commit 617c1216750ad6da957088a4c8f9092dc508a463

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit 5afdb62a392eaf8ae41e09b9dd37b7922abd03b5
Subproject commit f76caba013e1a653a3ef375911949c056c054c8e

View File

@ -66,6 +66,7 @@ public:
private:
std::list<std::unique_ptr<Transaction>> m_pendingQueue;
std::list<std::unique_ptr<Transaction>> m_completedQueue;
int m_inProgress = 0;
bool m_running = true;
struct Worker

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);
}