]> git.llucax.com Git - software/libev.git/commitdiff
make timers best-effort non-drifting
authorroot <root>
Sun, 11 Nov 2007 00:05:59 +0000 (00:05 +0000)
committerroot <root>
Sun, 11 Nov 2007 00:05:59 +0000 (00:05 +0000)
ev++.h
ev.c

diff --git a/ev++.h b/ev++.h
index 95d0a76d117d184b766fdbe67885506ae7f06f20..aa46fb422ac0425d2475da841771070cdf8505b7 100644 (file)
--- a/ev++.h
+++ b/ev++.h
@@ -46,6 +46,21 @@ namespace ev {
 
   #include "ev.h"
 
 
   #include "ev.h"
 
+  enum {
+    UNDEF    = EV_UNDEF,
+    NONE     = EV_NONE,
+    READ     = EV_READ,
+    WRITE    = EV_WRITE,
+    TIMEOUT  = EV_TIMEOUT,
+    PERIODIC = EV_PERIODIC,
+    SIGNAL   = EV_SIGNAL,
+    IDLE     = EV_IDLE,
+    CHECK    = EV_CHECK,
+    PREPARE  = EV_PREPARE,
+    CHILD    = EV_CHILD,
+    ERROR    = EV_ERROR,
+  };
+
   typedef ev_tstamp tstamp;
 
   inline ev_tstamp now (EV_P)
   typedef ev_tstamp tstamp;
 
   inline ev_tstamp now (EV_P)
diff --git a/ev.c b/ev.c
index a605a57ba6c520032cf7d0810936dc3d3ae44ef3..000c3699256fc6fa3e0d8231e0e79e054d16007c 100644 (file)
--- a/ev.c
+++ b/ev.c
@@ -1339,7 +1339,7 @@ ev_timer_stop (EV_P_ struct ev_timer *w)
       downheap ((WT *)timers, timercnt, ((W)w)->active - 1);
     }
 
       downheap ((WT *)timers, timercnt, ((W)w)->active - 1);
     }
 
-  ((WT)w)->at = w->repeat;
+  ((WT)w)->at -= mn_now;
 
   ev_stop (EV_A_ (W)w);
 }
 
   ev_stop (EV_A_ (W)w);
 }