avoid crash on stupid but allowable usage of pthread_mutex_unlock

unlocking an unlocked mutex is not UB for robust or error-checking
mutexes, so we must avoid calling __pthread_self (which might crash
due to lack of thread-register initialization) until after checking
that the mutex is locked.
1 file changed