It doesn't set errno, check the return value.
Pthread_mutex_unlock returns 0 when successful.
If the following condition(s) is detected, the
pthread_mutex_unlock
will return:
EINVAL m does not refer to a valid mutex.
EPERM The mutex is not owned by the thread.