chiark
/
gitweb
/
~mdw
/
mLib
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d4704de
)
Rearrange timeout handling to avoid list corruptions.
author
mdw
<mdw>
Thu, 23 Mar 2000 20:42:08 +0000
(20:42 +0000)
committer
mdw
<mdw>
Thu, 23 Mar 2000 20:42:08 +0000
(20:42 +0000)
sel.c
patch
|
blob
|
blame
|
history
diff --git
a/sel.c
b/sel.c
index 55b599089222ae895dbbde04249821ab7b3b297a..04d9ed5464cbe959048b4480f4a844bd09e008ab 100644
(file)
--- a/
sel.c
+++ b/
sel.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: sel.c,v 1.
7 1999/12/11 11:12:17
mdw Exp $
+ * $Id: sel.c,v 1.
8 2000/03/23 20:42:08
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.8 2000/03/23 20:42:08 mdw
+ * Rearrange timeout handling to avoid list corruptions.
+ *
* Revision 1.7 1999/12/11 11:12:17 mdw
* Fix comment formatting error.
*
* Revision 1.7 1999/12/11 11:12:17 mdw
* Fix comment formatting error.
*
@@
-374,16
+377,20
@@
int sel_select(sel_state *s)
/* --- Run through the timers --- */
/* --- Run through the timers --- */
- {
+
if (s->timers && TV_CMP(&s->timers->tv, <=, &a.now))
{
sel_timer *t, *tt;
sel_timer *t, *tt;
- for (t = s->timers; t && TV_CMP(&t->tv, <=, &a.now); t = tt) {
+ tt = s->timers;
+ for (t = tt; t && TV_CMP(&t->tv, <=, &a.now); t = t->next)
+ ;
+ if (t) {
+ t->prev->next = 0;
+ t->prev = (sel_timer *)&s->timers;
+ }
+ s->timers = t;
+ for (t = tt; t; t = tt) {
tt = t->next;
tt = t->next;
- t->next = t->prev = t;
t->func(&a.now, t->p);
}
t->func(&a.now, t->p);
}
- s->timers = t;
- if (t)
- t->prev = (sel_timer *)&s->timers;
}
/* --- And finally run through the files --- *
}
/* --- And finally run through the files --- *