When i call 'pthread_cond_signal' during my thread's function, does this call unlock the mutex i currently use? (Not the one the pthread_cond_wait is waiting for).
Only the mutex given to pthread_cond_(timed_)wait() is unlocked to give other threads the chance to change the condition. At the end of pthread_cond_wait, the mutex is locked again. No other functions lock/unlock mutexes.
3
votes
No, it doesn't unlock any mutex at all. pthread_cond_waitdoes unlock its mutex, and when it exits the mutex is locked again.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more