timer.h File Reference

Timer related functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sr_timer

Defines

#define TIMER_PROC_INIT_FLAG   (1<<0)

Typedefs

typedef void( timer_function )(unsigned int ticks, void *param)
typedef unsigned long long utime_t
typedef void( utimer_function )(utime_t uticks, void *param)

Functions

int count_timer_procs (void)
 Counts the timer processes that needs to be created.
void destroy_timer (void)
 Free timers.
unsigned int get_ticks (void)
 Return the actual tick count.
utime_t get_uticks (void)
 Return the actual utick count.
int init_timer (void)
 Initialize the timers, allocate jiffies and ujiffies in shared memory.
int register_timer (timer_function f, void *param, unsigned int interval)
 register a periodic timer;
int register_timer_process (timer_function f, void *param, unsigned int interval, unsigned int flags)
 register a timer process
int register_utimer (utimer_function f, void *param, unsigned int interval)
 register a periodic utimer;
int start_timer_processes (void)
 Start timer processes.


Detailed Description

Timer related functions.

Definition in file timer.h.


Define Documentation

#define TIMER_PROC_INIT_FLAG   (1<<0)

Definition at line 64 of file timer.h.

Referenced by init_timer(), mod_init(), and start_timer_processes().


Typedef Documentation

typedef void( timer_function)(unsigned int ticks, void *param)

timer function

Definition at line 44 of file timer.h.

typedef unsigned long long utime_t

internal time representation

Definition at line 41 of file timer.h.

typedef void( utimer_function)(utime_t uticks, void *param)

timer function for utimers

Definition at line 46 of file timer.h.


Function Documentation

int count_timer_procs ( void   ) 

Counts the timer processes that needs to be created.

Returns:
number of necessary timer processes

Definition at line 415 of file timer.c.

References sr_timer_process::next, NULL, sr_timer_process::timer_list, and sr_timer_process::utimer_list.

Referenced by init_multi_proc_support().

void destroy_timer ( void   ) 

Free timers.

Definition at line 135 of file timer.c.

References jiffies, shm_free, and ujiffies.

Referenced by cleanup().

unsigned int get_ticks ( void   ) 

utime_t get_uticks ( void   ) 

Return the actual utick count.

Definition at line 248 of file timer.c.

References LM_CRIT, and ujiffies.

Referenced by set_1timer(), and set_timer().

int init_timer ( void   ) 

Initialize the timers, allocate jiffies and ujiffies in shared memory.

Returns:
0 on success, negative result on error

Definition at line 99 of file timer.c.

References E_CFG, E_OUT_OF_MEM, jiffies, LM_CRIT, LM_ERR, new_timer_process_list(), NULL, shm_malloc(), TIMER_PROC_INIT_FLAG, TIMER_TICK, ujiffies, and UTIMER_TICK.

Referenced by main().

int register_timer ( timer_function  f,
void *  param,
unsigned int  interval 
)

register a periodic timer;

Note:
If you need it in a module, register it from mod_init or it won't work otherwise
Returns:
negative result on error, the timer id on success

Definition at line 173 of file timer.c.

References E_OUT_OF_MEM, sr_timer::id, new_sr_timer(), sr_timer::next, NULL, and sr_timer_process::timer_list.

Referenced by init_black_lists(), init_dlg_db(), initialize_kill(), mod_init(), and pike_init().

int register_timer_process ( timer_function  f,
void *  param,
unsigned int  interval,
unsigned int  flags 
)

register a timer process

Returns:
negative result on error, the timer id on success

Definition at line 211 of file timer.c.

References E_OUT_OF_MEM, sr_timer::id, new_sr_timer(), new_timer_process_list(), sr_timer::next, NULL, and sr_timer_process::timer_list.

Referenced by mod_init().

int register_utimer ( utimer_function  f,
void *  param,
unsigned int  interval 
)

register a periodic utimer;

Note:
If you need it in a module, register it from mod_init or it won't work otherwise
Returns:
negative result on error, the timer id on success

Definition at line 193 of file timer.c.

References E_OUT_OF_MEM, sr_timer::id, new_sr_timer(), sr_timer::next, NULL, and sr_timer_process::utimer_list.

Referenced by mod_init().

int start_timer_processes ( void   ) 


Generated on Thu May 24 20:00:44 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6