Add orthogonal OK/ERROR states.

Replace state check mutex with atomic.

Update DDS example documentation.
This commit is contained in:
Alexey Rybalchenko
2015-08-24 17:35:30 +02:00
committed by Mohammad Al-Turany
parent a7ab33a10e
commit fbf7dbf2ba
38 changed files with 838 additions and 615 deletions

View File

@@ -12,6 +12,7 @@
* @author D. Klein, A. Rybalchenko
*/
#include <cstdlib> // quick_exit()
#include <sstream>
#include "FairMQLogger.h"
@@ -24,7 +25,7 @@ FairMQContextZMQ::FairMQContextZMQ(int numIoThreads)
if (fContext == NULL)
{
LOG(ERROR) << "failed creating context, reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
if (zmq_ctx_set(fContext, ZMQ_IO_THREADS, numIoThreads) != 0)

View File

@@ -12,6 +12,8 @@
* @author A. Rybalchenko
*/
#include <cstdlib> // quick_exit()
#include <zmq.h>
#include "FairMQPollerZMQ.h"
@@ -72,11 +74,11 @@ FairMQPollerZMQ::FairMQPollerZMQ(map< string,vector<FairMQChannel> >& channelsMa
{
LOG(ERROR) << "At least one of the provided channel keys for poller initialization is invalid";
LOG(ERROR) << "Out of Range error: " << oor.what() << '\n';
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
}
FairMQPollerZMQ::FairMQPollerZMQ(FairMQSocket& dataSocket, FairMQSocket& cmdSocket)
FairMQPollerZMQ::FairMQPollerZMQ(FairMQSocket& cmdSocket, FairMQSocket& dataSocket)
: items()
, fNumItems(2)
, fOffsetMap()
@@ -111,7 +113,7 @@ FairMQPollerZMQ::FairMQPollerZMQ(FairMQSocket& dataSocket, FairMQSocket& cmdSock
else
{
LOG(ERROR) << "invalid poller configuration, exiting.";
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
}
@@ -165,7 +167,7 @@ bool FairMQPollerZMQ::CheckInput(const string channelKey, const int index)
{
LOG(ERROR) << "Invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "Out of Range error: " << oor.what() << '\n';
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
}
@@ -184,7 +186,7 @@ bool FairMQPollerZMQ::CheckOutput(const string channelKey, const int index)
{
LOG(ERROR) << "Invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "Out of Range error: " << oor.what() << '\n';
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
}

View File

@@ -43,7 +43,7 @@ class FairMQPollerZMQ : public FairMQPoller
virtual ~FairMQPollerZMQ();
private:
FairMQPollerZMQ(FairMQSocket& dataSocket, FairMQSocket& cmdSocket);
FairMQPollerZMQ(FairMQSocket& cmdSocket, FairMQSocket& dataSocket);
zmq_pollitem_t* items;
int fNumItems;

View File

@@ -12,6 +12,7 @@
* @author D. Klein, A. Rybalchenko
*/
#include <cstdlib> // quick_exit()
#include <sstream>
#include "FairMQSocketZMQ.h"
@@ -43,7 +44,7 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, int num
if (fSocket == NULL)
{
LOG(ERROR) << "failed creating socket " << fId << ", reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
if (zmq_setsockopt(fSocket, ZMQ_IDENTITY, &fId, fId.length()) != 0)
@@ -99,7 +100,7 @@ void FairMQSocketZMQ::Connect(const string& address)
{
LOG(ERROR) << "failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
// error here means incorrect configuration. exit if it happens.
exit(EXIT_FAILURE);
quick_exit(EXIT_FAILURE);
}
}