mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 10:01:47 +00:00
Initialize shared memory only if it is used.
This commit is contained in:
committed by
Mohammad Al-Turany
parent
ac1da4db66
commit
8cf1cbb930
@@ -17,8 +17,8 @@ using namespace std;
|
||||
using namespace FairMQ::shmem;
|
||||
|
||||
// Context to hold the ZeroMQ sockets
|
||||
unique_ptr<FairMQContextSHM> FairMQSocketSHM::fContext = unique_ptr<FairMQContextSHM>(new FairMQContextSHM(1));
|
||||
// bool FairMQSocketSHM::fContextInitialized = false;
|
||||
unique_ptr<FairMQContextSHM> FairMQSocketSHM::fContext; // = unique_ptr<FairMQContextSHM>(new FairMQContextSHM(1));
|
||||
bool FairMQSocketSHM::fContextInitialized = false;
|
||||
|
||||
FairMQSocketSHM::FairMQSocketSHM(const string& type, const string& name, const int numIoThreads, const string& id /*= ""*/)
|
||||
: FairMQSocket(ZMQ_SNDMORE, ZMQ_RCVMORE, ZMQ_DONTWAIT)
|
||||
@@ -31,11 +31,11 @@ FairMQSocketSHM::FairMQSocketSHM(const string& type, const string& name, const i
|
||||
{
|
||||
fId = id + "." + name + "." + type;
|
||||
|
||||
// if (!fContextInitialized)
|
||||
// {
|
||||
// fContext = unique_ptr<FairMQContextSHM>(new FairMQContextSHM(1));
|
||||
// fContextInitialized = true;
|
||||
// }
|
||||
if (!fContextInitialized)
|
||||
{
|
||||
fContext = unique_ptr<FairMQContextSHM>(new FairMQContextSHM(1));
|
||||
fContextInitialized = true;
|
||||
}
|
||||
|
||||
if (zmq_ctx_set(fContext->GetContext(), ZMQ_IO_THREADS, numIoThreads) != 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user