解决程序退出时资源释放顺序问题

This commit is contained in:
xiongziliang
2019-05-20 17:03:04 +08:00
parent 8311524935
commit 40c1d1cae6
3 changed files with 20 additions and 3 deletions

View File

@@ -190,6 +190,10 @@ bool checkArgs(Args &&args,First &&first,KeyTypes && ...keys){
throw InvalidArgs("缺少必要参数:" #__VA_ARGS__); \
}
static unordered_map<uint64_t ,PlayerProxy::Ptr> s_proxyMap;
static recursive_mutex s_proxyMapMtx;
//安装api接口
void installWebApi() {
addHttpListener();
@@ -342,8 +346,6 @@ void installWebApi() {
});
static unordered_map<uint64_t ,PlayerProxy::Ptr> s_proxyMap;
static recursive_mutex s_proxyMapMtx;
API_REGIST(api,addStreamProxy,{
CHECK_ARGS("vhost","app","stream","url");
//添加拉流代理
@@ -424,6 +426,9 @@ void installWebApi() {
val["msg"] = "success";
});
}
void unInstallWebApi(){
lock_guard<recursive_mutex> lck(s_proxyMapMtx);
s_proxyMap.clear();
}