Re: [Sofia-sip-devel] Patch to make su_timer_set_for_ever behave like SIGALRM

2008-03-04 Thread Pekka Pessi
2008/2/28, Jarod Neuner [EMAIL PROTECTED]:
 This patch attempts to correct for the clock drift that results from
  using poll() to do timing.

  It still will not generate extra signals for missed timer events, but
  assuming that timer events are never missed, the average interval time
  will always be equal to the requested interval time.

Thanks for the patch. I've pushed it into darcs repository.
-- 
Pekka.Pessi mail at nokia.com

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


[Sofia-sip-devel] Patch to make su_timer_set_for_ever behave like SIGALRM

2008-02-27 Thread Jarod Neuner
This patch attempts to correct for the clock drift that results from
using poll() to do timing.  

It still will not generate extra signals for missed timer events, but
assuming that timer events are never missed, the average interval time
will always be equal to the requested interval time.

-Jarod
--- libsofia-sip-ua/su/su_timer.c   2008-01-17 08:45:30.0 -0600
+++ libsofia-sip-ua/su/su_timer.c   2008-02-27 16:27:54.0 -0600
@@ -522,11 +522,15 @@
   }
 }
 else if (t-sut_running == run_for_ever) {
+  su_time_t deadline = t-sut_when;
   t-sut_woken++;
   t-sut_when = now;
   f(su_root_magic(su_task_root(t-sut_task)), t, t-sut_arg), n++;
-  if (t-sut_running == run_for_ever)
-   su_timer_set0(timers, t, f, t-sut_arg, now, t-sut_duration);
+  if (t-sut_running == run_for_ever) {
+while (su_time_cmp(su_time_add(deadline,t-sut_duration),now)  0)
+  deadline = su_time_add(deadline,t-sut_duration);
+su_timer_set0(timers, t, f, t-sut_arg, deadline, t-sut_duration);
+  }
 }
 else {
   t-sut_when = now;
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel