Reputation: 537
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).
Upvotes: 3
Views: 1583
Reputation: 14392
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.
Upvotes: 5
Reputation: 96233
No, it doesn't unlock any mutex at all. pthread_cond_wait
does unlock its mutex, and when it exits the mutex is locked again.
Upvotes: 3