mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-17 08:17:42 -04:00
Warn if forked from the event loop during event_reinit()
Calling fork() from the event loop is not a great idea, since at least it shares some internal pipes (for handling signals) before event_reinit() call Closes: #833 (cherry picked from commit 497ef904d544ac51de43934549dbeccce8e6e8f8)
This commit is contained in:
parent
5349a07ea7
commit
b75922ae5b
6
event.c
6
event.c
@ -987,6 +987,12 @@ event_reinit(struct event_base *base)
|
|||||||
|
|
||||||
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
|
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
|
||||||
|
|
||||||
|
if (base->running_loop) {
|
||||||
|
event_warnx("%s: forked from the event_loop.", __func__);
|
||||||
|
res = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
evsel = base->evsel;
|
evsel = base->evsel;
|
||||||
|
|
||||||
/* check if this event mechanism requires reinit on the backend */
|
/* check if this event mechanism requires reinit on the backend */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user