Use future instead of thread for device rateLogger

This commit is contained in:
Alexey Rybalchenko 2018-10-09 16:40:11 +02:00 committed by Dennis Klein
parent 1aab354a5d
commit 45354f268b

View File

@ -24,6 +24,7 @@
#include <functional> #include <functional>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <future>
#include <algorithm> // std::max #include <algorithm> // std::max
using namespace std; using namespace std;
@ -491,7 +492,7 @@ void FairMQDevice::RunWrapper()
LOG(info) << "DEVICE: Running..."; LOG(info) << "DEVICE: Running...";
// start the rate logger thread // start the rate logger thread
thread rateLogger(&FairMQDevice::LogSocketRates, this); future<void> rateLogger = async(launch::async, &FairMQDevice::LogSocketRates, this);
// notify transports to resume transfers // notify transports to resume transfers
{ {
@ -552,7 +553,7 @@ void FairMQDevice::RunWrapper()
CallAndHandleError(std::bind(&FairMQDevice::PostRun, this)); CallAndHandleError(std::bind(&FairMQDevice::PostRun, this));
rateLogger.join(); rateLogger.get();
} }
void FairMQDevice::HandleSingleChannelInput() void FairMQDevice::HandleSingleChannelInput()