In an already running old code, i have found a place where they were trying to unlock an already unlocked mutex.
I am clear that unlocking an already unlocked mutex will lead to undefined behaviour.
But my doubts are
- Am I able to predict the behaviour by checking the compiler documentation?
- Is there any chances that it may lead to blocking of the thread (deadlock)?
- Undefined behaviour will be seen on the
pthread_mutex_unlock
where it was unlocking the already unlocked thread? Or the undefined behaviour can be seen on any of the next pthread calls ?