diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index f4e3df3..9f988c1 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -90,7 +90,7 @@ const std::string App::GetPkgName() void App::Init() { - udp_msg_mutex_ = new std::mutex(); + udp_msg_mutex_ = std::make_shared(); HandlerMgr::Instance()->Init(); JsonDataMgr::Instance()->Init(); @@ -148,7 +148,6 @@ void App::UnInit() HandlerMgr::Instance()->UnInit(); FreeUdpMsgQueue(); - delete udp_msg_mutex_; udp_msg_mutex_ = nullptr; a8::XPrintf("wsproxy terminated instance_id:%d pid:%d\n", {f8::App::Instance()->GetInstanceId(), diff --git a/server/wsproxy/app.h b/server/wsproxy/app.h index 2358fbe..bbdc436 100644 --- a/server/wsproxy/app.h +++ b/server/wsproxy/app.h @@ -48,7 +48,7 @@ private: private: PerfMonitor perf_; - std::mutex* udp_msg_mutex_ = nullptr; + std::shared_ptr udp_msg_mutex_; UdpMsgNode* udp_top_node_ = nullptr; UdpMsgNode* udp_bot_node_ = nullptr; UdpMsgNode* udp_work_node_ = nullptr;