On the pthread_mutex_lock() page:
If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection should not be provided. Attempting to lock the mutex causes a deadlock. If thread tries to unlock a mutex that it hasn't locked, or a mutex that is unlocked, undefined behavior results.
If the mutex type is PTHREAD_MUTEX_DEFAULT, try recursively blocking the mutex results in undefined mode. Attempting to unlock the mutex if it was not blocked by the calling thread results in undefined behavior. Attempt to unlock the mutex if it is not locked. in undefined mode.
Bottom line: It is possible to cause a deadlock with only one thread if you try to block an existing mutex.
In case you are interested, Linux PTHREAD_MUTEX_DEFAULT usually synonymous with PTHREAD_MUTEX_NORMAL , which in turn is what is used by default in the mutex initializer.
source share