fix: 修复一个极端情况下的死锁问题

This commit is contained in:
MistEO
2023-01-12 15:33:53 +08:00
parent 8a6a1e7b41
commit bfcb7b6b0c

View File

@@ -49,8 +49,14 @@ Assistant::~Assistant()
m_thread_exit = true;
m_thread_idle = true;
m_condvar.notify_all();
m_msg_condvar.notify_all();
{
std::unique_lock<std::mutex> lock(m_mutex);
m_condvar.notify_all();
}
{
std::unique_lock<std::mutex> lock(m_msg_mutex);
m_msg_condvar.notify_all();
}
if (m_working_thread.joinable()) {
m_working_thread.join();