Functions

timer_proc.h File Reference

SIP-router core :: timer_proc.h - separate process timers. More...

#include "local_timer.h"
Include dependency graph for timer_proc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions


Detailed Description

(unrelated to the main fast and slow timers)

Module: SIP-router core

Definition in file timer_proc.h.


Function Documentation

int fork_basic_timer ( int  child_id,
char *  desc,
int  make_sock,
timer_function *  f,
void *  param,
int  interval 
)

Forks a very basic periodic timer process, that just sleep()s for the specified interval and then calls the timer function. The new "basic timer" process execution start immediately, the sleep() is called first (so the first call to the timer function will happen <interval> seconds after the call to fork_basic_timer)

Parameters:
child_id 
See also:
fork_process()
Parameters:
desc 
See also:
fork_process()
Parameters:
make_sock 
See also:
fork_process()
Parameters:
f timer function/callback
param parameter passed to the timer function
interval interval in seconds.
Returns:
pid of the new process on success, -1 on error (doesn't return anything in the child process)

Definition at line 77 of file timer_proc.c.

References fork_process().

Here is the call graph for this function:

int fork_basic_utimer ( int  child_id,
char *  desc,
int  make_sock,
utimer_function *  f,
void *  param,
int  uinterval 
)

Forks a very basic periodic timer process, that just ms-sleep()s for the specified interval and then calls the timer function. The new "basic timer" process execution start immediately, the ms-sleep() is called first (so the first call to the timer function will happen <interval> seconds after the call to fork_basic_utimer)

Parameters:
child_id 
See also:
fork_process()
Parameters:
desc 
See also:
fork_process()
Parameters:
make_sock 
See also:
fork_process()
Parameters:
f timer function/callback
param parameter passed to the timer function
uinterval interval in mili-seconds.
Returns:
pid of the new process on success, -1 on error (doesn't return anything in the child process)

Definition at line 115 of file timer_proc.c.

References fork_process(), and TICKS_TO_MS.

Referenced by child_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int fork_local_timer_process ( int  child_id,
char *  desc,
int  make_sock,
struct local_timer **  lt_h 
)

Forks a separate timer process running a local_timer.h type of timer A pointer to the local_timer handle (allocated in shared memory) is returned in lt_h. It can be used to add/delete more timers at runtime (via local_timer_add()/local_timer_del() a.s.o). If timers are added from separate processes, some form of locking must be used (all the calls to local_timer* must be enclosed by locks if it cannot be guaranteed that they cannot execute in the same time) The timer "engine" must be run manually from the child process. For example a very simple local timer process that just runs a single periodic timer can be started in the following way: struct local_timer* lt_h;

pid=fork_local_timer_process(...., &lt_h); if (pid==0){ timer_init(&my_timer, my_timer_f, 0, 0); local_timer_add(&lt_h, &my_timer, S_TO_TICKS(10), get_ticks_raw()); while(1) { sleep(1); local_timer_run(lt, get_ticks_raw()); } }

Parameters:
child_id 
See also:
fork_process()
Parameters:
desc 
See also:
fork_process()
Parameters:
make_sock 
See also:
fork_process()
Parameters:
lt_h local_timer handler
Returns:
pid to the parent, 0 to the child, -1 if error.

Definition at line 166 of file timer_proc.c.

References fork_process().

Here is the call graph for this function:

int fork_sync_timer ( int  child_id,
char *  desc,
int  make_sock,
timer_function *  f,
void *  param,
int  interval 
)

Forks a very basic periodic timer process, that just sleep()s for the specified interval and then calls the timer function. The new "sync timer" process execution start immediately, the sleep() is called first (so the first call to the timer function will happen <interval> seconds after the call to fork_sync_timer)

Parameters:
child_id 
See also:
fork_process()
Parameters:
desc 
See also:
fork_process()
Parameters:
make_sock 
See also:
fork_process()
Parameters:
f timer function/callback
param parameter passed to the timer function
interval interval in seconds.
Returns:
pid of the new process on success, -1 on error (doesn't return anything in the child process)

Definition at line 214 of file timer_proc.c.

References fork_process().

Referenced by child_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int fork_sync_utimer ( int  child_id,
char *  desc,
int  make_sock,
utimer_function *  f,
void *  param,
int  uinterval 
)

Forks a very basic periodic timer process, that just ms-sleep()s for the specified interval and then calls the timer function. The new "sync timer" process execution start immediately, the ms-sleep() is called first (so the first call to the timer function will happen <interval> seconds after the call to fork_basic_utimer)

Parameters:
child_id 
See also:
fork_process()
Parameters:
desc 
See also:
fork_process()
Parameters:
make_sock 
See also:
fork_process()
Parameters:
f timer function/callback
param parameter passed to the timer function
uinterval interval in mili-seconds.
Returns:
pid of the new process on success, -1 on error (doesn't return anything in the child process)

Definition at line 259 of file timer_proc.c.

References fork_process(), and TICKS_TO_MS.

Here is the call graph for this function:

int register_basic_timers ( int  timers  ) 

timers

Parameters:
timers number of basic timer processes
Returns:
0 on success; -1 on error

Definition at line 52 of file timer_proc.c.

Referenced by mod_init().

Here is the caller graph for this function:

int register_sync_timers ( int  timers  ) 

sync timers

timers

Parameters:
timers number of basic timer processes
Returns:
0 on success; -1 on error

Definition at line 189 of file timer_proc.c.

Referenced by mod_init().

Here is the caller graph for this function: