This commit is contained in:
azw 2023-05-07 07:57:45 +00:00
parent 3533d0a768
commit a1ffc20c85
2 changed files with 8 additions and 16 deletions

View File

@ -115,10 +115,10 @@ bool App::Init(int argc, char* argv[])
});
uuid_ = std::make_shared<a8::uuid::SnowFlake>();
loop_mutex_ = new std::mutex();
loop_cond_ = new std::condition_variable();
msg_mutex_ = new std::mutex();
udp_msg_mutex_ = new std::mutex();
loop_mutex_ = std::make_shared<std::mutex>();
loop_cond_ = std::make_shared<std::condition_variable>();
msg_mutex_ = std::make_shared<std::mutex>();
udp_msg_mutex_ = std::make_shared<std::mutex>();
srand(time(nullptr));
InitLog();
@ -197,14 +197,6 @@ void App::UnInit()
FreeSocketMsgQueue();
FreeUdpMsgQueue();
delete msg_mutex_;
msg_mutex_ = nullptr;
delete udp_msg_mutex_;
udp_msg_mutex_ = nullptr;
delete loop_cond_;
loop_cond_ = nullptr;
delete loop_mutex_;
loop_mutex_ = nullptr;
a8::XPrintf("wsproxy terminated instance_id:%d pid:%d\n", {instance_id_, getpid()});
}

View File

@ -78,15 +78,15 @@ private:
std::set<int> flags_;
std::shared_ptr<a8::uuid::SnowFlake> uuid_;
std::mutex *loop_mutex_ = nullptr;
std::condition_variable *loop_cond_ = nullptr;
std::shared_ptr<std::mutex> loop_mutex_;
std::shared_ptr<std::condition_variable> loop_cond_;
std::mutex* msg_mutex_ = nullptr;
std::shared_ptr<std::mutex> msg_mutex_;
MsgNode* top_node_ = nullptr;
MsgNode* bot_node_ = nullptr;
MsgNode* work_node_ = nullptr;
std::mutex* udp_msg_mutex_ = nullptr;
std::shared_ptr<std::mutex> udp_msg_mutex_;
UdpMsgNode* udp_top_node_ = nullptr;
UdpMsgNode* udp_bot_node_ = nullptr;
UdpMsgNode* udp_work_node_ = nullptr;