On non window machine prefer nanosleep over usleep.

Nanosleep allows us to handle EINTR signals properly unlike usleep. This could
increase the stability in our testing infrastructure.