summaryrefslogtreecommitdiff
path: root/event.c
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2019-07-01 23:54:02 +0300
committerAzat Khuzhin <azat@libevent.org>2019-07-01 23:55:29 +0300
commit497ef904d544ac51de43934549dbeccce8e6e8f8 (patch)
treeb7e06640dba7d57c83f214ddd151e11bcae414ad /event.c
parent5388a002f5ad3bdfc756584dc58485fc3db135d0 (diff)
downloadlibevent-497ef904d544ac51de43934549dbeccce8e6e8f8.tar.gz
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
Diffstat (limited to 'event.c')
-rw-r--r--event.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/event.c b/event.c
index fa4f2802..aa6c6fba 100644
--- a/event.c
+++ b/event.c
@@ -1003,6 +1003,12 @@ event_reinit(struct event_base *base)
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;
/* check if this event mechanism requires reinit on the backend */