We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9d29590 commit 32ae492Copy full SHA for 32ae492
src/threading/thread.cpp
@@ -74,8 +74,8 @@ Thread::~Thread()
74
kill();
75
76
// Make sure start finished mutex is unlocked before it's destroyed
77
- m_start_finished_mutex.try_lock();
78
- m_start_finished_mutex.unlock();
+ if (m_start_finished_mutex.try_lock())
+ m_start_finished_mutex.unlock();
79
80
}
81
@@ -196,6 +196,10 @@ void Thread::threadProc(Thread *thr)
196
thr->m_retval = thr->run();
197
198
thr->m_running = false;
199
+ // Unlock m_start_finished_mutex to prevent data race condition on Windows.
200
+ // On Windows with VS2017 build TerminateThread is called and this mutex is not
201
+ // released. We try to unlock it from caller thread and it's refused by system.
202
+ thr->m_start_finished_mutex.unlock();
203
g_logger.deregisterThread();
204
205
0 commit comments