posixcompat: properly handle PTHREAD_MUTEX_RECURSIVE and BF thread id assignment.