Thread.Sleep is a sign of a poorly designed program.
by Peter Ritchie.
Thread.Sleep has it’s use: simulating lengthy operations while testing/debugging on an MTA thread. In .NET there’s no other reason to use it.
Thread.Sleep(n) means block the current thread for at least the number of timeslices (or thread quantums) that can occur within n milliseconds. The length of a timeslice is different on different versions/types of Windows and different processors and generally ranges from 15 to 30 milliseconds. This means the thread is almost guaranteed to block for more than n milliseconds. The likelihood that your thread will re-awaken exactly after n milliseconds is about as impossible as impossible can be. So, Thread.Sleep is pointless for timing. Read the rest of this entry »