Small change to use pthread resursive mutex, usleep