summaryrefslogtreecommitdiff
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'event.c')
-rw-r--r--event.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/event.c b/event.c
index 783eef1..520e336 100644
--- a/event.c
+++ b/event.c
@@ -144,7 +144,12 @@ x_cb (struct event *ev, int revents)
static void
x_cb_sig (EV_P_ struct ev_signal *w, int revents)
{
- x_cb ((struct event *)(((char *)w) - offsetof (struct event, iosig.sig)), revents);
+ struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.sig));
+
+ if (revents & EV_ERROR)
+ event_del (ev);
+
+ x_cb (ev, revents);
}
static void
@@ -152,7 +157,9 @@ x_cb_io (EV_P_ struct ev_io *w, int revents)
{
struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.io));
- if (!(ev->ev_events & EV_PERSIST) && ev_is_active (w))
+ if (revents & EV_ERROR)
+ event_del (ev);
+ else if (!(ev->ev_events & EV_PERSIST) && ev_is_active (w))
ev_io_stop (EV_A_ w);
x_cb (ev, revents);