Unverified Commit a36f87e3 authored by kladko's avatar kladko

SKALE-4586 Added Thread Pool

parent 9b1b6981
......@@ -30,6 +30,7 @@
#include "common.h"
#include "SGXException.h"
#include "ExitRequestedException.h"
#include "ZMQMessage.h"
#include "ZMQServer.h"
#include "sgxwallet_common.h"
......@@ -274,12 +275,24 @@ void ZMQServer::doOneServerLoop() {
}
}
void ZMQServer::workerThreadProcessNextMessage() {
usleep(1000000);
cerr << "WORKER LOOP" << endl;
}
void ZMQServer::workerThreadMessageProcessLoop(ZMQServer* _agent ) {
CHECK_STATE(_agent);
_agent->waitOnGlobalStartBarrier();
// do work forever until told to exit
while (!isExitRequested) {
usleep(1000000);
cerr << "WORKER LOOP" << endl;
try {
_agent->workerThreadProcessNextMessage();
} catch (ExitRequestedException& e) {
break;
} catch (Exception& e) {
spdlog::error(string("Caught exception in worker thread loop:") + e.what());
}
}
spdlog::info("Exit requested. Exiting worker thread.");
}
\ No newline at end of file
......@@ -79,6 +79,8 @@ public:
static void workerThreadMessageProcessLoop(ZMQServer* agent );
void workerThreadProcessNextMessage();
};
......
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