dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosTimerAsync (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSDATETIME
 
USHORT DosTimerAsync(ulTime, hsem, phtimer)
ULONG ulTime;       /* time before semaphore is cleared     */
HSEM hsem;          /* system-semaphore handle              */
PHTIMER phtimer;    /* pointer to variable for timer handle */
 
The DosTimerAsync function creates a timer that counts for a specified
number of milliseconds, then clears a specified semaphore.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
ulTime     Specifies the time (in milliseconds) before the semaphore is
           cleared. This value is rounded up to the next clock tick, if
           necessary.
 
hsem       Identifies the system semaphore that signals the end of the
           timer. This handle must have been created previously by using the
           DosCreateSem function with the CSEM_PUBLIC flag.
 
phtimer    Points to the variable that receives the timer handle.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_TS_NOTIMER
     ERROR_TS_SEMHANDLE
 
Comments
 
The timer runs asynchronously──that is, while the timer counts the time, the
DosTimerAsync function returns to let the process continue to execute other
tasks. The timer counts the time only once.
 
The given semaphore must be a system semaphore. If the process uses the
semaphore to determine when data is available, it must use the DosSemSet
function to set the semaphore before calling the DosTimerAsync function.
 
The timer handle specified by the phtimer parameter can be used by the
DosTimerStop function to cancel the timer.
 
The DosTimerAsync function is similar to the DosSleep function except that
DosTimerAsync returns immediately; DosSleep returns only after the specified
time has elapsed.
 
See Also
 
DosCreateSem, DosSemSet, DosSleep, DosTimerStart, DosTimerStop