Simplify recursive pthread mutex Use a PTHREAD_MUTEX_RECURSIVE mutex instead of the hand-rolled approach.