Remove the lock entirely as per PR discussion

Correctly unlock mutex before its destruction

As per https://en.cppreference.com/w/cpp/thread/mutex/~mutex destroying a locked mutex is undefined behavior and MSVC++ decides to throw in this case

Swap out unique for scoped lock and readd comment
This commit is contained in:
Salvage 2022-12-09 13:41:04 +01:00
parent 41461514d6
commit c586ac9be2
No known key found for this signature in database
GPG Key ID: 273B3EDF04E681D7
1 changed files with 0 additions and 3 deletions

View File

@ -163,9 +163,6 @@ ServiceThread::Impl::~Impl() {
m_wakeup_event->Signal(); m_wakeup_event->Signal();
m_host_thread.join(); m_host_thread.join();
// Lock mutex.
m_session_mutex.lock();
// Close all remaining sessions. // Close all remaining sessions.
for (const auto& [server_session, manager] : m_sessions) { for (const auto& [server_session, manager] : m_sessions) {
server_session->Close(); server_session->Close();