diff options
author | root <root> | 2007-11-09 15:15:20 +0000 |
---|---|---|
committer | root <root> | 2007-11-09 15:15:20 +0000 |
commit | 7eebd23082204e2dce00017f483f1e876ba3079a (patch) | |
tree | e28142555430b2906ba02cd180170f089224d5c3 | |
parent | 93de14fb2ac9996d3330d1fce388e75b3b2fb91a (diff) |
*** empty log message ***
-rw-r--r-- | ev.c | 37 | ||||
-rw-r--r-- | ev.h | 2 |
2 files changed, 30 insertions, 9 deletions
@@ -344,21 +344,27 @@ queue_events (EV_P_ W *events, int eventcnt, int type) ev_feed_event (EV_A_ events [i], type); } -static void -fd_event (EV_P_ int fd, int events) +inline void +fd_event (EV_P_ int fd, int revents) { ANFD *anfd = anfds + fd; struct ev_io *w; for (w = (struct ev_io *)anfd->head; w; w = (struct ev_io *)((WL)w)->next) { - int ev = w->events & events; + int ev = w->events & revents; if (ev) ev_feed_event (EV_A_ (W)w, ev); } } +void +ev_feed_fd_event (EV_P_ int fd, int revents) +{ + fd_event (EV_A_ fd, revents); +} + /*****************************************************************************/ static void @@ -554,6 +560,24 @@ sighandler (int signum) } } +void +ev_feed_signal_event (EV_P_ int signum) +{ +#if EV_MULTIPLICITY + assert (("feeding signal events is only supported in the default loop", loop == default_loop)); +#endif + + --signum; + + if (signum < 0 || signum >= signalmax) + return; + + signals [signum].gotsig = 0; + + for (w = signals [signum].head; w; w = w->next) + ev_feed_event (EV_A_ (W)w, EV_SIGNAL); +} + static void sigcb (EV_P_ struct ev_io *iow, int revents) { @@ -569,12 +593,7 @@ sigcb (EV_P_ struct ev_io *iow, int revents) for (signum = signalmax; signum--; ) if (signals [signum].gotsig) - { - signals [signum].gotsig = 0; - - for (w = signals [signum].head; w; w = w->next) - ev_feed_event (EV_A_ (W)w, EV_SIGNAL); - } + sigevent (EV_A_ signum + 1); } static void @@ -331,6 +331,8 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent /* feeds an event into a watcher as if the event actually occured */ /* accepts any ev_watcher type */ void ev_feed_event (EV_P_ void *w, int revents); +void ev_feed_fd_event (EV_P_ int fd, int revents); +void ev_feed_signal_event (EV_P_ int signum); void ev_io_start (EV_P_ struct ev_io *w); void ev_io_stop (EV_P_ struct ev_io *w); |