提交 109d5e89 authored 作者: blu's avatar blu

potential bugfix: deadlock

上级 57196c71
......@@ -405,7 +405,14 @@ private:
exit(1);
}
unique_lock<mutex> lk(this->mutMsg);
this->cvMsg.wait(lk, [this] {return this->gotFormat;});
bool got = this->cvMsg.wait_for(lk, 30s, [this] {return this->gotFormat;});
if(got){
}else{
// restart
spdlog::error("evmlmotion {} failed wait for avformatctx for {}s, restart", devSn, 30);
exit(1);
}
return ret;
}
......
......@@ -22,6 +22,7 @@ update: 2019/09/10
using namespace std;
using namespace zmqhelper;
using namespace std::chrono_literals;
class EvPusher: public TinyThread {
private:
......@@ -295,7 +296,14 @@ private:
exit(1);
}
unique_lock<mutex> lk(this->mutMsg);
this->cvMsg.wait(lk, [this] {return this->gotFormat;});
bool got = this->cvMsg.wait_for(lk, 30s, [this] {return this->gotFormat;});
if(got){
}else{
// restart
spdlog::error("evpusher {} failed wait for avformatctx for {}s, restart", devSn, 30);
exit(1);
}
return ret;
}
......
......@@ -428,7 +428,14 @@ private:
exit(1);
}
unique_lock<mutex> lk(this->mutMsg);
this->cvMsg.wait(lk, [this] {return this->gotFormat;});
bool got = this->cvMsg.wait_for(lk, 30s, [this] {return this->gotFormat;});
if(got){
}else{
// restart
spdlog::error("evpusher {} failed wait for avformatctx for {}s, restart", devSn, 30);
exit(1);
}
return ret;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论