Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 13 years ago
parent
commit
684c70bb5d
2 changed files with 30 additions and 9 deletions
  1. +28
    -9
      ev.c
  2. +2
    -0
      ev.h

+ 28
- 9
ev.c View File

@ -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


+ 2
- 0
ev.h View File

@ -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);


Loading…
Cancel
Save