SIP-router core :: timer_proc.h - separate process timers. More...
#include "local_timer.h"

Go to the source code of this file.
(unrelated to the main fast and slow timers)
Module: SIP-router core
Definition in file timer_proc.h.
| 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)
| child_id |
| desc |
| make_sock |
| f | timer function/callback | |
| param | parameter passed to the timer function | |
| interval | interval in seconds. |
Definition at line 77 of file timer_proc.c.
References fork_process().

| 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)
| child_id |
| desc |
| make_sock |
| f | timer function/callback | |
| param | parameter passed to the timer function | |
| uinterval | interval in mili-seconds. |
Definition at line 115 of file timer_proc.c.
References fork_process(), and TICKS_TO_MS.
Referenced by child_init().


| 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(...., <_h); if (pid==0){ timer_init(&my_timer, my_timer_f, 0, 0); local_timer_add(<_h, &my_timer, S_TO_TICKS(10), get_ticks_raw()); while(1) { sleep(1); local_timer_run(lt, get_ticks_raw()); } }
| child_id |
| desc |
| make_sock |
| lt_h | local_timer handler |
Definition at line 166 of file timer_proc.c.
References fork_process().

| 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)
| child_id |
| desc |
| make_sock |
| f | timer function/callback | |
| param | parameter passed to the timer function | |
| interval | interval in seconds. |
Definition at line 214 of file timer_proc.c.
References fork_process().
Referenced by child_init().


| 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)
| child_id |
| desc |
| make_sock |
| f | timer function/callback | |
| param | parameter passed to the timer function | |
| uinterval | interval in mili-seconds. |
Definition at line 259 of file timer_proc.c.
References fork_process(), and TICKS_TO_MS.

| int register_basic_timers | ( | int | timers | ) |
timers
| timers | number of basic timer processes |
Definition at line 52 of file timer_proc.c.
Referenced by mod_init().

| int register_sync_timers | ( | int | timers | ) |
sync timers
timers
| timers | number of basic timer processes |
Definition at line 189 of file timer_proc.c.
Referenced by mod_init().

1.7.1