mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-14 14:54:49 -04:00
Be absolutely sure to clear pncalls before leaving event_signal_closure
I thought we'd fixed the cases where this could come up, but apparently having an event_base_break() happen while processing signal events could get us in trouble. Found by Remi Gacogne. Sourceforge issue 3451433 .
This commit is contained in:
parent
ba4d66961e
commit
11f36a5f76
6
event.c
6
event.c
@ -1038,6 +1038,7 @@ event_signal_closure(struct event_base *base, struct event *ev)
|
|||||||
|
|
||||||
/* Allows deletes to work */
|
/* Allows deletes to work */
|
||||||
ncalls = ev->ev_ncalls;
|
ncalls = ev->ev_ncalls;
|
||||||
|
if (ncalls != 0)
|
||||||
ev->ev_pncalls = &ncalls;
|
ev->ev_pncalls = &ncalls;
|
||||||
EVBASE_RELEASE_LOCK(base, th_base_lock);
|
EVBASE_RELEASE_LOCK(base, th_base_lock);
|
||||||
while (ncalls) {
|
while (ncalls) {
|
||||||
@ -1051,9 +1052,12 @@ event_signal_closure(struct event_base *base, struct event *ev)
|
|||||||
should_break = base->event_break;
|
should_break = base->event_break;
|
||||||
EVBASE_RELEASE_LOCK(base, th_base_lock);
|
EVBASE_RELEASE_LOCK(base, th_base_lock);
|
||||||
|
|
||||||
if (should_break)
|
if (should_break) {
|
||||||
|
if (ncalls != 0)
|
||||||
|
ev->ev_pncalls = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Common timeouts are special timeouts that are handled as queues rather than
|
/* Common timeouts are special timeouts that are handled as queues rather than
|
||||||
|
Loading…
x
Reference in New Issue
Block a user