chiark / gitweb /
Use new `tv' macros. Fix ordering bug for timeout selectors.
authormdw <mdw>
Fri, 21 May 1999 22:13:59 +0000 (22:13 +0000)
committermdw <mdw>
Fri, 21 May 1999 22:13:59 +0000 (22:13 +0000)
sel.c

diff --git a/sel.c b/sel.c
index b32aa8cbd09ea535d9e591ee40d39711d4876586..43f95dc063d688a363ea4b90b6a2af6adea8e61c 100644 (file)
--- a/sel.c
+++ b/sel.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: sel.c,v 1.2 1999/05/15 10:33:32 mdw Exp $
+ * $Id: sel.c,v 1.3 1999/05/21 22:13:59 mdw Exp $
  *
  * I/O multiplexing support
  *
  *
  * I/O multiplexing support
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sel.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sel.c,v $
+ * Revision 1.3  1999/05/21 22:13:59  mdw
+ * Use new `tv' macros.  Fix ordering bug for timeout selectors.
+ *
  * Revision 1.2  1999/05/15 10:33:32  mdw
  * Fix copyright notices.
  *
  * Revision 1.2  1999/05/15 10:33:32  mdw
  * Fix copyright notices.
  *
@@ -169,7 +172,7 @@ void sel_addtimer(sel_state *s, sel_timer *t,
 
   /* --- More line noise --- */
   
 
   /* --- More line noise --- */
   
-  while (*tt && tv_cmp(&(*tt)->tv, tv) > 0)
+  while (*tt && TV_CMP(&(*tt)->tv, <, tv))
     tt = &(*tt)->next;
   t->next = *tt;
   t->prev = (sel_timer *)tt;
     tt = &(*tt)->next;
   t->next = *tt;
   t->prev = (sel_timer *)tt;
@@ -213,7 +216,7 @@ int sel_select(sel_state *s)
   if (s->timers) {
     struct timeval now;
     gettimeofday(&now, 0);
   if (s->timers) {
     struct timeval now;
     gettimeofday(&now, 0);
-    tv_sub(&tv, &now, &s->timers->tv);
+    TV_SUB(&tv, &s->timers->tv, &now);
     err = select(s->files ? s->files->fd + 1 : 0,
                 fd + SEL_READ, fd + SEL_WRITE, fd + SEL_EXC,
                 &tv);
     err = select(s->files ? s->files->fd + 1 : 0,
                 fd + SEL_READ, fd + SEL_WRITE, fd + SEL_EXC,
                 &tv);
@@ -228,7 +231,7 @@ int sel_select(sel_state *s)
 
   {
     sel_timer *t, *tt;
 
   {
     sel_timer *t, *tt;
-    for (t = s->timers; t && tv_cmp(&t->tv, &tv) <= 0; t = tt) {
+    for (t = s->timers; t && TV_CMP(&t->tv, <=, &tv); t = tt) {
       tt = t->next;
       t->next = t->prev = t;
       t->func(&tv, t->p);
       tt = t->next;
       t->next = t->prev = t;
       t->func(&tv, t->p);