mirror of https://github.com/AxioDL/metaforce.git
ClientProcess fix
This commit is contained in:
parent
037404c5ff
commit
88276db37f
|
@ -5,10 +5,6 @@ if(MSVC)
|
||||||
# Shaddup MSVC
|
# Shaddup MSVC
|
||||||
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244)
|
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244)
|
||||||
else()
|
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")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit d2fb800b926c9d4ef76e54242c54f3fe369f7c3d
|
Subproject commit 617c1216750ad6da957088a4c8f9092dc508a463
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5afdb62a392eaf8ae41e09b9dd37b7922abd03b5
|
Subproject commit f76caba013e1a653a3ef375911949c056c054c8e
|
|
@ -66,6 +66,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::list<std::unique_ptr<Transaction>> m_pendingQueue;
|
std::list<std::unique_ptr<Transaction>> m_pendingQueue;
|
||||||
std::list<std::unique_ptr<Transaction>> m_completedQueue;
|
std::list<std::unique_ptr<Transaction>> m_completedQueue;
|
||||||
|
int m_inProgress = 0;
|
||||||
bool m_running = true;
|
bool m_running = true;
|
||||||
|
|
||||||
struct Worker
|
struct Worker
|
||||||
|
|
|
@ -71,11 +71,13 @@ void ClientProcess::Worker::proc()
|
||||||
while (m_proc.m_pendingQueue.size())
|
while (m_proc.m_pendingQueue.size())
|
||||||
{
|
{
|
||||||
std::unique_ptr<Transaction> trans = std::move(m_proc.m_pendingQueue.front());
|
std::unique_ptr<Transaction> trans = std::move(m_proc.m_pendingQueue.front());
|
||||||
|
++m_proc.m_inProgress;
|
||||||
|
m_proc.m_pendingQueue.pop_front();
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
trans->run(m_blendTok);
|
trans->run(m_blendTok);
|
||||||
lk.lock();
|
lk.lock();
|
||||||
m_proc.m_completedQueue.push_back(std::move(trans));
|
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();
|
m_proc.m_waitCv.notify_one();
|
||||||
if (!m_proc.m_running)
|
if (!m_proc.m_running)
|
||||||
|
@ -158,7 +160,7 @@ void ClientProcess::swapCompletedQueue(std::list<std::unique_ptr<Transaction>>&
|
||||||
void ClientProcess::waitUntilComplete()
|
void ClientProcess::waitUntilComplete()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(m_mutex);
|
std::unique_lock<std::mutex> lk(m_mutex);
|
||||||
while (m_pendingQueue.size())
|
while (m_pendingQueue.size() || m_inProgress)
|
||||||
m_waitCv.wait(lk);
|
m_waitCv.wait(lk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue