The Delay Function
The Delay Function
There is a better way for your application to delay its own operation than
repeatedly calling the TickCount function-namely, by executing Delay, an
operating-system routine that causes the system to wait a specified number of
ticks before resuming execution of your application. When Delay exits, the
Operating System returns the current value of the Ticks global variable to the
calling application. Delay is used primarily to suspend an application
for a particular amount of time and to execute a routine at a later time- after
Delay has exited. But this provides much less control over a routine's future
execution than that provided by the scheduling services of the Time Manager.
With the Delay function, you cannot return to your application's code during
the delay. Once you queue and activate a
Time Manager task, however, control immediately returns to your
application.
Furthermore, the Time Manager provides far greater accuracy than the
Delay function. Using the TickCount and Delay functions may provide
sufficiently accurate timing control, but you need to use the
Time Manager routines in cases where very high resolutions are required,
as in performance measurements based on elapsed-time information.