X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/4b05fe94e44407cd62092863e204337c521e7d8a..0b7b062fb0b1c4f1ab22a52bd91f3c86195a084e:/event.c 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);