A thread can also tell the system that it does not want to be schedulable for a certain amount of time. This is accomplished by calling
VOID Sleep(DWORD dwMilliseconds);
This function causes the thread to suspend itself until
dwMilliseconds have elapsed. There are a few important things to notice about
Sleep allows the thread to voluntarily give up the remainder of its time slice.
The system makes the thread not schedulable for approximately the number of milliseconds specified. That’s right—if you tell the system you want to sleep for 100 milliseconds, you will sleep approximately that long, but possibly several seconds or minutes more. Remember that Windows is not a real-time operating system. Your thread will probably ...