aboutsummaryrefslogtreecommitdiffstats
path: root/src/InputZeroMQReader.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-15 20:06:27 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-15 20:06:27 +0200
commita45009f0063a98260c835786901dbd00ec5e9705 (patch)
tree0bede8886e805b1c06b89dcb401e6ded3e6ab19a /src/InputZeroMQReader.cpp
parent1e01627b0653c76e215a9d8f5e9fffe510e247a6 (diff)
downloaddabmod-a45009f0063a98260c835786901dbd00ec5e9705.tar.gz
dabmod-a45009f0063a98260c835786901dbd00ec5e9705.tar.bz2
dabmod-a45009f0063a98260c835786901dbd00ec5e9705.zip
Move running flag out of workerdata
Diffstat (limited to 'src/InputZeroMQReader.cpp')
-rw-r--r--src/InputZeroMQReader.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/InputZeroMQReader.cpp b/src/InputZeroMQReader.cpp
index 70b0afc..58d76c9 100644
--- a/src/InputZeroMQReader.cpp
+++ b/src/InputZeroMQReader.cpp
@@ -84,6 +84,10 @@ int InputZeroMQReader::GetNextFrame(void* buffer)
{
const size_t framesize = 6144;
+ if (not worker_.is_running()) {
+ return 0;
+ }
+
std::shared_ptr<std::vector<uint8_t> > incoming;
/* Do some prebuffering because reads will happen in bursts
@@ -98,7 +102,7 @@ int InputZeroMQReader::GetNextFrame(void* buffer)
in_messages_.wait_and_pop(incoming);
}
- if (! workerdata_.running) {
+ if (not worker_.is_running()) {
throw zmq_input_overflow();
}
@@ -217,14 +221,13 @@ void InputZeroMQWorker::RecvProcess(struct InputZeroMQThreadData* workerdata)
subscriber.close();
- workerdata->running = false;
+ running = false;
workerdata->in_messages->notify();
}
void InputZeroMQWorker::Start(struct InputZeroMQThreadData* workerdata)
{
running = true;
- workerdata->running = true;
recv_thread = boost::thread(&InputZeroMQWorker::RecvProcess, this, workerdata);
}