/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ /** * FairMQSplitter.cxx * * @since 2012-12-06 * @author D. Klein, A. Rybalchenko */ #include #include #include "FairMQLogger.h" #include "FairMQSplitter.h" FairMQSplitter::FairMQSplitter() { } FairMQSplitter::~FairMQSplitter() { } void FairMQSplitter::Run() { LOG(INFO) << ">>>>>>> Run <<<<<<<"; boost::thread rateLogger(boost::bind(&FairMQDevice::LogSocketRates, this)); int received = 0; int direction = 0; while (fState == RUNNING) { FairMQMessage* msg = fTransportFactory->CreateMessage(); received = fPayloadInputs->at(0)->Receive(msg); if (received > 0) { fPayloadOutputs->at(direction)->Send(msg); direction++; if (direction >= fNumOutputs) { direction = 0; } received = 0; } delete msg; } try { rateLogger.interrupt(); rateLogger.join(); } catch(boost::thread_resource_error& e) { LOG(ERROR) << e.what(); } FairMQDevice::Shutdown(); }