How Your Application Specifies Scheduling Options
opportunity to schedule other processes. Using the WaitNextEvent function, you can control when your process is eligible to be switched out.
The sleep parameter to WaitNextEvent specifies a length of time, in ticks, during which the application relinquishes the CPU if no events are pending.
For example, if you specify 15 ticks in the sleep parameter and no events are
pending in your application's event queue when you call WaitNextEvent, the processes until an event becomes available or the time expires. Once the
specified time expires or an event becomes available for your application,
your process to run at the next available chance. You can also use the
WakeUpProcess function to make a process eligible to run before the time in the sleep parameter expires.In general, you should specify a value greater
than 0 in the sleep parameter so that those applications that need processing
time can get it. If your application performs any periodic task, then the
frequency of the task usually determines what value you specify in the sleep
parameter. The less frequent the task, the higher the value of the sleep
parameter.