nanosleep instead of busy wait