Skip to content

Commit

Permalink
Merge pull request #1031 from leapmotion/fix-basic-thread
Browse files Browse the repository at this point in the history
Lock mutex before notifying condition variable
  • Loading branch information
jdonald authored Oct 31, 2017
2 parents ed02b38 + 6f49354 commit f798aa8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/autowiring/BasicThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ void BasicThread::OnStop(bool graceful) {
if (!m_wasStarted) {
std::lock_guard<std::mutex> lk(m_state->m_lock);
m_state->m_completed = true;
} else {
// Make sure that we lock before we notify all
std::lock_guard<std::mutex> lk(m_state->m_lock);
}

// State condition must be notified, in the event that anything is blocking
Expand Down

0 comments on commit f798aa8

Please sign in to comment.