Unverified Commit 832ff75a authored by kladko's avatar kladko

SKALE-4586 Added Thread Pool

parent fbdd91ac
...@@ -175,7 +175,9 @@ void ZMQServer::checkForExit() { ...@@ -175,7 +175,9 @@ void ZMQServer::checkForExit() {
} }
} }
void ZMQServer::poll() {
PollResult ZMQServer::poll() {
zmq_pollitem_t items[1]; zmq_pollitem_t items[1];
items[0].socket = *socket; items[0].socket = *socket;
items[0].events = ZMQ_POLLIN; items[0].events = ZMQ_POLLIN;
...@@ -184,8 +186,10 @@ void ZMQServer::poll() { ...@@ -184,8 +186,10 @@ void ZMQServer::poll() {
do { do {
checkForExit(); checkForExit();
pollResult = zmq_poll(items, 1, 1000); pollResult = zmq_poll(items, 1, 1);
} while (pollResult == 0); } while (pollResult == 0);
return GOT_INCOMING_MSG;
} }
string ZMQServer::receiveMessage(zmq::message_t& _identity) { string ZMQServer::receiveMessage(zmq::message_t& _identity) {
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "Agent.h" #include "Agent.h"
#include "WorkerThreadPool.h" #include "WorkerThreadPool.h"
typedef enum {GOT_INCOMING_MSG = 0, GOT_OUTFOING_MSG = 1} PollResult;
class ZMQServer : public Agent{ class ZMQServer : public Agent{
uint64_t workerThreads; uint64_t workerThreads;
...@@ -75,7 +77,7 @@ public: ...@@ -75,7 +77,7 @@ public:
void checkForExit(); void checkForExit();
void poll(); PollResult poll();
string receiveMessage(zmq::message_t& _identity); string receiveMessage(zmq::message_t& _identity);
......
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