from trunk: bug fix and potentital race condition from Alexander Drozdov

svn:r1026
This commit is contained in:
Niels Provos 2009-01-19 23:42:19 +00:00
parent 64fc3c7c30
commit 0ede290b3a
2 changed files with 6 additions and 1 deletions

View File

@ -285,8 +285,13 @@ event_reinit(struct event_base *base)
/* prevent internal delete */
if (base->sig.ev_signal_added) {
/* we cannot call event_del here because the base has
* not been reinitialized yet. */
event_queue_remove(base, &base->sig.ev_signal,
EVLIST_INSERTED);
if (base->sig.ev_signal.ev_flags & EVLIST_ACTIVE)
event_queue_remove(base, &base->sig.ev_signal,
EVLIST_ACTIVE);
base->sig.ev_signal_added = 0;
}

View File

@ -310,6 +310,7 @@ evsignal_process(struct event_base *base)
ncalls = sig->evsigcaught[i];
if (ncalls == 0)
continue;
sig->evsigcaught[i] -= ncalls;
for (ev = TAILQ_FIRST(&sig->evsigevents[i]);
ev != NULL; ev = next_ev) {
@ -319,7 +320,6 @@ evsignal_process(struct event_base *base)
event_active(ev, EV_SIGNAL, ncalls);
}
sig->evsigcaught[i] = 0;
}
}