Unverified Commit d4e26311 authored by kladko's avatar kladko

SKALE-4586 Added Thread Pool

parent 4066708d
1.78.0
\ No newline at end of file
1.83.0
\ No newline at end of file
......@@ -24,17 +24,14 @@
#include "Agent.h"
void Agent::notifyAllConditionVariables() {
messageCond.notify_all();
queueCond.notify_all();
}
Agent::Agent() : startedWorkers(false) {};
void Agent::waitOnGlobalStartBarrier() {
unique_lock<mutex> mlock(queueMutex);
unique_lock<mutex> lock(startMutex);
while (!startedWorkers) {
queueCond.wait(mlock);
// wait until notified to start running
startCond.wait(lock);
}
}
......@@ -49,7 +46,7 @@ void Agent::releaseWorkers() {
return;
}
lock_guard<mutex> lock(queueMutex);
lock_guard<mutex> lock(startMutex);
queueCond.notify_all();
startCond.notify_all();
}
......@@ -38,8 +38,8 @@ protected:
mutex messageMutex;
condition_variable messageCond;
condition_variable queueCond;
mutex queueMutex;
condition_variable startCond;
mutex startMutex;
recursive_mutex m;
......@@ -48,8 +48,6 @@ public:
Agent();
void notifyAllConditionVariables();
virtual ~Agent();
void releaseWorkers();
......
......@@ -260,11 +260,12 @@ void ZMQServer::doOneServerLoop() {
}
}
void ZMQServer::workerThreadMessageProcessLoop(ZMQServer* _agent ) {
CHECK_STATE(_agent);
_agent->waitOnGlobalStartBarrier();
// do work forever until told to exit
while (!isExitRequested) {
sleep(100);
sleep(1000);
cerr << "WORKER LOOP" << endl;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment