From: mdw Date: Fri, 21 May 1999 22:13:59 +0000 (+0000) Subject: Use new `tv' macros. Fix ordering bug for timeout selectors. X-Git-Tag: 2.0.4~304 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/commitdiff_plain/c05c6d833a613f1f8808aa8ed86058ab86f8e64c?ds=sidebyside Use new `tv' macros. Fix ordering bug for timeout selectors. --- diff --git a/sel.c b/sel.c index b32aa8c..43f95dc 100644 --- a/sel.c +++ b/sel.c @@ -1,6 +1,6 @@ /* -*-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 * @@ -30,6 +30,9 @@ /*----- 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. * @@ -169,7 +172,7 @@ void sel_addtimer(sel_state *s, sel_timer *t, /* --- 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; @@ -213,7 +216,7 @@ int sel_select(sel_state *s) 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); @@ -228,7 +231,7 @@ int sel_select(sel_state *s) { 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);