ADD_TIMER
Section: Kernel Reference Guide (9)
Updated: May 31, 1995
Index
Return to Main Contents
NAME
add_timer, del_timer, init_timer - manage event timers
SYNOPSIS
#include <asm/param.h>
#include <linux/timer.h>
extern void add_timer(struct timer_list * timer);
extern int del_timer(struct timer_list * timer);
extern inline void init_timer(struct timer_list * timer);
DESCRIPTION
add_timer schedules an event,
adding it to a linked list of events maintained by the kernel.
del_timer deletes a scheduled event.
timer points to a
struct timer_list {
struct timer_list *next;
struct timer_list *prev;
unsigned long expires;
unsigned long data;
void (*function)(unsigned long);
};
init_timer sets next and prev to NULL.
This is required for the argument of add_timer.
expires is the desired duration of the timer in jiffies, where
there are HZ (typically 100) jiffies per second.
When the timer expires, function is called with data
as its argument.
It is the responsibility of function to delete the event.
If the same function is managing several timers, the argument can be
used to distinguish which one expired.
RETURN VALUE
del_timer returns zero on error - if next or prev are
not NULL, but the timer was not found.
del_timer also sets expires to the time remaining before
the timer expires, and sets next and prev to NULL.
Thus, calling del_timer followed immediately by add_timer
is a no-op provided a kernel tick does not occur between the two calls.
AUTHOR
Linus Torvalds
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUE
-
- AUTHOR
-
This document was created by
man2html,
using the manual pages.
Time: 12:22:40 GMT, March 22, 2025