/* -*-c-*-
*
- * $Id: sel.c,v 1.8 2000/03/23 20:42:08 mdw Exp $
+ * $Id: sel.c,v 1.9 2001/02/03 19:07:08 mdw Exp $
*
* I/O multiplexing support
*
/*----- Revision history --------------------------------------------------*
*
* $Log: sel.c,v $
+ * Revision 1.9 2001/02/03 19:07:08 mdw
+ * Ensure that timers set to go off in the past don't case a problem.
+ *
* Revision 1.8 2000/03/23 20:42:08 mdw
* Rearrange timeout handling to avoid list corruptions.
*
if (!s->timers)
a.tvp = 0;
else {
- TV_SUB(&a.tv, &s->timers->tv, &a.now);
+ if (TV_CMP(&s->timers->tv, >, &a.now))
+ TV_SUB(&a.tv, &s->timers->tv, &a.now);
+ else {
+ a.tv.tv_sec = 0;
+ a.tv.tv_usec = 0;
+ }
a.tvp = &a.tv;
}
s->args = &a;