blob: d0cb2b3b4bcfbf88fdec7be51da51dd3d9b95c86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
diff --git a/event.c b/event.c
index acef2b2..ad4c7f0 100644
--- a/event.c
+++ b/event.c
@@ -926,13 +926,13 @@ event_reinit(struct event_base *base)
event_del_nolock_(&base->sig.ev_signal, EVENT_DEL_AUTOBLOCK);
event_debug_unassign(&base->sig.ev_signal);
memset(&base->sig.ev_signal, 0, sizeof(base->sig.ev_signal));
- if (base->sig.ev_signal_pair[0] != -1)
- EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
- if (base->sig.ev_signal_pair[1] != -1)
- EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
had_signal_added = 1;
base->sig.ev_signal_added = 0;
}
+ if (base->sig.ev_signal_pair[0] != -1)
+ EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
+ if (base->sig.ev_signal_pair[1] != -1)
+ EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
if (base->th_notify_fn != NULL) {
was_notifiable = 1;
base->th_notify_fn = NULL;
@@ -981,8 +981,12 @@ event_reinit(struct event_base *base)
if (evmap_reinit_(base) < 0)
res = -1;
} else {
- if (had_signal_added)
res = evsig_init_(base);
+ if (res == 0 && had_signal_added) {
+ res = event_add_nolock_(&base->sig.ev_signal, NULL, 0);
+ if (res == 0)
+ base->sig.ev_signal_added = 1;
+ }
}
/* If we were notifiable before, and nothing just exploded, become
|