Both threads blocking on call to boost::mutex::lock()
I have a boost::mutex that's being used in two threads. The first thread is constantly locking and unlocking the mutex. The second thread only uses the mutex on a certain condition. When this condition occurs, both threads block on the lock. What could possibly causing this?
Some random facts about my program: The mutex is a data member of class shared between the two threads. In the second thread, I am passing a pointer to the mutex to the function that uses it, but in the first thread I'm using the mutex by r开发者_开发百科eference.
Did you remember to unlock the mutex in the main thread after you signal the condition? Alternately, did you get into a deadlock situation?
精彩评论