Sleep a bit during the while loop

Insert a sleep command to avoid pegging the CPU.