mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
from trunk: bug fix and potentital race condition from Alexander Drozdov
svn:r1026
This commit is contained in:
parent
64fc3c7c30
commit
0ede290b3a
5
event.c
5
event.c
@ -285,8 +285,13 @@ event_reinit(struct event_base *base)
|
|||||||
|
|
||||||
/* prevent internal delete */
|
/* prevent internal delete */
|
||||||
if (base->sig.ev_signal_added) {
|
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,
|
event_queue_remove(base, &base->sig.ev_signal,
|
||||||
EVLIST_INSERTED);
|
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;
|
base->sig.ev_signal_added = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
signal.c
2
signal.c
@ -310,6 +310,7 @@ evsignal_process(struct event_base *base)
|
|||||||
ncalls = sig->evsigcaught[i];
|
ncalls = sig->evsigcaught[i];
|
||||||
if (ncalls == 0)
|
if (ncalls == 0)
|
||||||
continue;
|
continue;
|
||||||
|
sig->evsigcaught[i] -= ncalls;
|
||||||
|
|
||||||
for (ev = TAILQ_FIRST(&sig->evsigevents[i]);
|
for (ev = TAILQ_FIRST(&sig->evsigevents[i]);
|
||||||
ev != NULL; ev = next_ev) {
|
ev != NULL; ev = next_ev) {
|
||||||
@ -319,7 +320,6 @@ evsignal_process(struct event_base *base)
|
|||||||
event_active(ev, EV_SIGNAL, ncalls);
|
event_active(ev, EV_SIGNAL, ncalls);
|
||||||
}
|
}
|
||||||
|
|
||||||
sig->evsigcaught[i] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user