Distributed Information Management
4.5 Timer Library (DTQ)
Detailed description of the routines contained in the Timer Utility Library
Start a TimeOut request
void dtq_start_timer (time, user_routine, tag)
The time in seconds after which the user_routine should be called.
The address of a routine to be executed when the timer expires.
A parameter to be sent to the user_routine in order to identify the Timeout
request. Tag is also used as Request Identifier in order to stop the timer.
This routine starts a timer. When the timer expires the user_routine
will be called.
Stop (cancel) a TimeOut request
void dtq_stop_timer (tag)
The parameter given to dtq_start_timer.
This routine stops the timer. The user_routine will no longer
Sleep for a number of seconds
The time in seconds the process should be suspended for.
This routine suspends the process for the given number of seconds.
In Unix the sleep function exits when the process receives a signal, since
DIM uses signals, processes using the UNIX call directly will exit several
times and it would be difficult to compute the actual time slept. dtq_sleep
can be used instead it only exits when the sleep time elapses.
Routine written by the user, called when the timer started
by dtq_start_timer expires.
void user_routine (tag)
The parameter that identifies the request. The tag given to dtq_start_timer.
This routine is called when a timer started by dtq_start_timer