提交 f6d6b844 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 30d84b0e
...@@ -715,7 +715,6 @@ int main(int argc, const char *argv[]) ...@@ -715,7 +715,6 @@ int main(int argc, const char *argv[])
av_log_set_level(AV_LOG_ERROR); av_log_set_level(AV_LOG_ERROR);
queue<string> evtQueue; queue<string> evtQueue;
EvMLMotion es(&evtQueue); EvMLMotion es(&evtQueue);
es.detach();
#ifdef DEBUG #ifdef DEBUG
cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE ); cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE );
...@@ -732,17 +731,7 @@ int main(int argc, const char *argv[]) ...@@ -732,17 +731,7 @@ int main(int argc, const char *argv[])
} }
} }
#else #else
while(true) { es.join();
if(evtQueue.size() > 0) {
string p = evtQueue.front();
spdlog::info("evmlmotion event: {}", p);
evtQueue.pop();
}
else {
this_thread::sleep_for(chrono::duration(chrono::seconds(2)));
}
}
#endif #endif
return 0; return 0;
} }
\ No newline at end of file
...@@ -203,20 +203,6 @@ private: ...@@ -203,20 +203,6 @@ private:
exit(1); exit(1);
} }
thMsgProcessor = thread([this](){
while(true) {
auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno()));
continue;
}
// full proto msg received.
handleMsg(body);
}
});
thMsgProcessor.detach();
return ret; return ret;
} }
...@@ -512,6 +498,21 @@ public: ...@@ -512,6 +498,21 @@ public:
init(); init();
getInputFormat(); getInputFormat();
setupStream(); setupStream();
// thread for msg
thMsgProcessor = thread([this](){
while(true) {
auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno()));
continue;
}
// full proto msg received.
handleMsg(body);
}
});
thMsgProcessor.detach();
}; };
~EvSlicer() ~EvSlicer()
{ {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论