timers

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

CiTRCreateTimer, CiTRCancelTimer, CiTRDisableTimers, CiTRRenableTimers - Timers with callbacks  

SYNOPSIS

#include <timers.h>

Int CiTRCreateTimer (
    Int,            /* time until timer goes off */
    Void (*) (Int,Void *),/* routine to be called when timer expires */
    Void * );       /* user data that will be provided on callback */

Int CiTRCancelTimer (Int); /* identifier of the timer */

Void CiTRDisableTimers();

Void CiTRReenableTimers();  

DESCRIPTION

Implements a set of timer functions. Timers have callbacks (with parameters).

Any existing alarm(2) callbacks are preserved.


 Procedure:   CiTRCreateTimer


 Description: Routine to start the timer


 Return:      identifier for the timer. This is a unique number that
              will be passed as a parameter when the callback routine
              is called.  It is also used for CiTRCancelTimer
              -1 returned if no timers are available
              -2 invalid parameter


 Parameters:  secs            time until timer goes off
              callback         routine to be called when timer expires


 Globals:     nextalarm       recalculated at exit
              activetimers    recalculated as callbacks invoked
              generation      incremented


 Side Effect: resets the SIGALRM signal handler (either to self, or previous)
              may start the alarm timer


 Procedure:   CiTRCancelTimer


 Description: Cancels the timer whose id was returned as ID


 Return:      Time before alarm was due to go off


 Parameters:  ID returned by CiTRCreateTimer


 Globals:     nextalarm       recalculated at exit
              activetimers    recalculated as callbacks invoked
              generation      incremented


 Side Effect: None


 Procedure:   CiTRDisableTimers


 Description: Temporarily disables timers.
              (for when you are running noninterruptable code)


 Return:      None


 Parameters:  None


 Globals:     None


 Side Effect: None


 Procedure:   CiTRReenableTimers()


 Description:


 Return:      None


 Parameters:  None


 Globals:     None


 Side Effect: None  

DIAGNOSTICS

None.  

WARNINGS

None  

SEE ALSO

alarm(2)  

EXAMPLES

See timer_sample.c  

Known Bugs

None  

Author

David Horton - CiTR  

Copyright

Centre for Information Technology Research, 1993


 

Index

NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
WARNINGS
SEE ALSO
EXAMPLES
Known Bugs
Author
Copyright

This document was created by man2html, using the manual pages.
Time: 23:40:49 GMT, September 27, 2019