Make sem_wait interrupt safe.