local_timer.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2007 iptelorg GmbH
  5. *
  6. * This file is part of ser, a free SIP server.
  7. *
  8. * ser is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * For a license to use the ser software under conditions
  14. * other than those described here, or to purchase support for this
  15. * software, please contact iptel.org by e-mail at the following addresses:
  16. * [email protected]
  17. *
  18. * ser is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  26. */
  27. /* local timer routines
  28. * WARNING: this should be used only from within the same process.
  29. * The local timers are not multi-process or multi-thread safe
  30. * (there are no locks)
  31. *
  32. * History:
  33. * --------
  34. * 2007-11-22 created by andrei
  35. */
  36. #ifndef _local_timer_h
  37. #define _local_timer_h
  38. #include "timer_ticks.h"
  39. #include "timer_funcs.h"
  40. struct local_timer {
  41. /* private timer information */
  42. ticks_t prev_ticks; /* last time we ran the timer */
  43. struct timer_lists timer_lst; /* actual timer lists */
  44. };
  45. #define local_timer_init(tl, fun, param, flgs) timer_init(tl, fun, param, flgs)
  46. #define local_timer_reinit(tl) timer_reinit((tl))
  47. int init_local_timer(struct local_timer *lt_handle, ticks_t crt_ticks);
  48. void destroy_local_timer(struct local_timer* lt_handle);
  49. int local_timer_add(struct local_timer* h, struct timer_ln* tl, ticks_t delta,
  50. ticks_t crt_ticks);
  51. void local_timer_del(struct local_timer* h, struct timer_ln* tl);
  52. void local_timer_run(struct local_timer* lt, ticks_t crt_ticks);
  53. #endif /* _local_timer_h */