mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
add support for I/O threads to the interface (only used with ZeroMQ).
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
#include "FairMQSocketZMQ.h"
|
||||
#include "FairMQLogger.h"
|
||||
|
||||
boost::shared_ptr<FairMQContextZMQ> FairMQSocketZMQ::fContext = boost::shared_ptr<FairMQContextZMQ>(new FairMQContextZMQ(1)); // TODO: numIoThreads!
|
||||
boost::shared_ptr<FairMQContextZMQ> FairMQSocketZMQ::fContext = boost::shared_ptr<FairMQContextZMQ>(new FairMQContextZMQ(1));
|
||||
|
||||
FairMQSocketZMQ::FairMQSocketZMQ(const string& type, int num) :
|
||||
FairMQSocketZMQ::FairMQSocketZMQ(const string& type, int num, int numIoThreads) :
|
||||
fBytesTx(0),
|
||||
fBytesRx(0),
|
||||
fMessagesTx(0),
|
||||
@@ -22,9 +22,14 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, int num) :
|
||||
id << type << "." << num;
|
||||
fId = id.str();
|
||||
|
||||
int rc = zmq_ctx_set (fContext->GetContext(), ZMQ_IO_THREADS, numIoThreads);
|
||||
if (rc != 0){
|
||||
LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
fSocket = zmq_socket(fContext->GetContext(), GetConstant(type));
|
||||
|
||||
int rc = zmq_setsockopt(fSocket, ZMQ_IDENTITY, &fId, fId.length());
|
||||
rc = zmq_setsockopt(fSocket, ZMQ_IDENTITY, &fId, fId.length());
|
||||
if (rc != 0) {
|
||||
LOG(ERROR) << "failed setting socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
class FairMQSocketZMQ : public FairMQSocket
|
||||
{
|
||||
public:
|
||||
FairMQSocketZMQ(const string& type, int num);
|
||||
FairMQSocketZMQ(const string& type, int num, int numIoThreads);
|
||||
|
||||
virtual string GetId();
|
||||
|
||||
|
@@ -31,9 +31,9 @@ FairMQMessage* FairMQTransportFactoryZMQ::CreateMessage(void* data, size_t size)
|
||||
return new FairMQMessageZMQ(data, size);
|
||||
}
|
||||
|
||||
FairMQSocket* FairMQTransportFactoryZMQ::CreateSocket(const string& type, int num)
|
||||
FairMQSocket* FairMQTransportFactoryZMQ::CreateSocket(const string& type, int num, int numIoThreads)
|
||||
{
|
||||
return new FairMQSocketZMQ(type, num);
|
||||
return new FairMQSocketZMQ(type, num, numIoThreads);
|
||||
}
|
||||
|
||||
FairMQPoller* FairMQTransportFactoryZMQ::CreatePoller(const vector<FairMQSocket*>& inputs)
|
||||
|
@@ -24,7 +24,7 @@ class FairMQTransportFactoryZMQ : public FairMQTransportFactory
|
||||
virtual FairMQMessage* CreateMessage();
|
||||
virtual FairMQMessage* CreateMessage(size_t size);
|
||||
virtual FairMQMessage* CreateMessage(void* data, size_t size);
|
||||
virtual FairMQSocket* CreateSocket(const string& type, int num);
|
||||
virtual FairMQSocket* CreateSocket(const string& type, int num, int numIoThreads);
|
||||
virtual FairMQPoller* CreatePoller(const vector<FairMQSocket*>& inputs);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user