summaryrefslogtreecommitdiff
path: root/event.c
diff options
context:
space:
mode:
authorroot <root>2007-11-29 12:21:05 +0000
committerroot <root>2007-11-29 12:21:05 +0000
commit8d0f4d263d9a5601bb7d419e7db00970e288cb7e (patch)
treef1eb4dde57119a2d01d733eb8d897414e7720a52 /event.c
parente036fde31e607a47af3e63e9c23cef34d88a2582 (diff)
many fixes to event emulation
Diffstat (limited to 'event.c')
-rw-r--r--event.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/event.c b/event.c
index 1666f62..1d30ce5 100644
--- a/event.c
+++ b/event.c
@@ -160,13 +160,8 @@ x_cb_io (EV_P_ struct ev_io *w, int revents)
{
struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.io));
- if (revents & EV_ERROR)
+ if ((revents & EV_ERROR) || !(ev->ev_events & EV_PERSIST))
event_del (ev);
- else if (!(ev->ev_events & EV_PERSIST) && ev_is_active (w))
- {
- ev_io_stop (EV_A_ w);
- ev->ev_flags &= ~EVLIST_INSERTED;
- }
x_cb (ev, revents);
}
@@ -237,8 +232,10 @@ int event_add (struct event *ev, struct timeval *tv)
ev->ev_flags |= EVLIST_TIMEOUT;
}
else
- if (ev_is_active (&ev->to))
+ {
ev_timer_stop (EV_A_ &ev->to);
+ ev->ev_flags &= ~EVLIST_TIMEOUT;
+ }
ev->ev_flags |= EVLIST_ACTIVE;
@@ -250,17 +247,9 @@ int event_del (struct event *ev)
dLOOPev;
if (ev->ev_events & EV_SIGNAL)
- {
- /* sig */
- if (ev_is_active (&ev->iosig.sig))
- ev_signal_stop (EV_A_ &ev->iosig.sig);
- }
+ ev_signal_stop (EV_A_ &ev->iosig.sig);
else if (ev->ev_events & (EV_READ | EV_WRITE))
- {
- /* io */
- if (ev_is_active (&ev->iosig.io))
- ev_io_stop (EV_A_ &ev->iosig.io);
- }
+ ev_io_stop (EV_A_ &ev->iosig.io);
if (ev_is_active (&ev->to))
ev_timer_stop (EV_A_ &ev->to);