diff options
author | jamoflaw <jamoflaw@gmail.com> | 2019-05-27 23:05:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-27 23:05:20 +0100 |
commit | 50dca7cf0ee2b15ea5c9d406d99a73f33bc77711 (patch) | |
tree | b1684a3ed6efbb68e2b6cf44ef205309af857dbe | |
parent | 78e1baede85026dea5eb43fbcda4bf8a08033031 (diff) | |
download | bullet3-50dca7cf0ee2b15ea5c9d406d99a73f33bc77711.tar.gz |
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.
-rw-r--r-- | src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp b/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp index d80af09c7..a03f6dc57 100644 --- a/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp +++ b/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp @@ -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(); |