From d21f7213586a4665d3c201d3c25f5e4feac5fef6 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 1 Apr 2020 15:45:06 +0200 Subject: [PATCH] Implement ZmqRecvModule stop procedure --- core-writer/src/ZmqRecvModule.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core-writer/src/ZmqRecvModule.cpp b/core-writer/src/ZmqRecvModule.cpp index f481900..38dd787 100644 --- a/core-writer/src/ZmqRecvModule.cpp +++ b/core-writer/src/ZmqRecvModule.cpp @@ -39,8 +39,7 @@ void ZmqRecvModule::start( cout << "[ZmqRecvModule::start]"; cout << " Starting with parameters:"; cout << "\tconnect_address: " << connect_address; - cout << "\tn_receiving_thread: " << n_receiving_threads; - cout << endl; + cout << "\tn_receiving_thread: " << n_receiving_threads << endl; #endif is_receiving_ = true; @@ -53,8 +52,21 @@ void ZmqRecvModule::start( void ZmqRecvModule::stop() { + #ifdef DEBUG_OUTPUT + using namespace date; + using namespace chrono; + cout << "[" << system_clock::now() << "]"; + cout << "[ZmqRecvModule::stop]"; + cout << " Stop receiving threads." << endl; + #endif + is_receiving_ = false; + for (auto& thread_ptr:receiving_threads_) { + thread_ptr.join(); + } + + receiving_threads_.clear(); } void ZmqRecvModule::receive_thread(const string& connect_address)