Destroy semaphore after join

I can't quite work out the logic behind this fix though I get a consistent hang on the worker threads (both my worker threads get stuck on sem_wait() - Line 181) when the semaphore is destroyed before the thread is joined, and the application never exits.

This change resolves this.
This commit is contained in:
jamoflaw
2019-05-27 23:05:20 +01:00
committed by GitHub
parent 78e1baede8
commit 50dca7cf0e

View File

@@ -304,8 +304,8 @@ void btThreadSupportPosix::stopThreads()
checkPThreadFunction(sem_post(threadStatus.startSemaphore));
checkPThreadFunction(sem_wait(m_mainSemaphore));
destroySem(threadStatus.startSemaphore);
checkPThreadFunction(pthread_join(threadStatus.thread, 0));
destroySem(threadStatus.startSemaphore);
}
destroySem(m_mainSemaphore);
m_activeThreadStatus.clear();