| 
.TH TIMER 9
.SH NAME
Timer, timeradd, timerdel \- clock scheduling procedures
.SH SYNOPSIS
.ta \w'\fLstruct 'u
.EX
enum {
	/* Timer modes */
	Trelative,  /* Timer programmed in ns from now */
	Tabsolute,  /* Timer programmed in ns since epoch */
	Tperiodic,  /* Periodic timer, period in ns */
};
.EE
.PP
.EX
struct	Timer
{
	int   tmode;  /* See above */
	void  tns;    /* Meaning defined by mode */
	void  (*tf)(Ureg *, Timer *);
	void  *ta;
};
.EE
.PP
.B
void	timeradd(Timer *nt);
.PP
.B
void	timerdel(Timer *dt);
.SH DESCRIPTION
Timer functions are used to set functions which execute at the specified
time. These functions are executed at the granularity of the system's
timer interrupt.
.I timeradd (9)
adds or modifies a timer
.I nt .
.I timerdel (9)
deletes a timer
.I dt .
Timers are guaranteed to not execute before the set time period. Periodic
timers should use the
.I addclock0link (9)
interface. Relative and absolute timers are triggered only once; after
execution, these timers are deleted.
.SH BUGS
When adding an absolute timer with
.I timeradd (9),
there is no check that the timer is set for a time in the past. This
effectively guarantees all absolute timers to execute.
.SH SOURCE
.B /sys/src/9/port/portclock.c
.br
.SH SEE ALSO
.IR delay (9),
.IR seconds (9),
.IR sleep (9)
 |