summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ev.c9
-rw-r--r--ev.h1
-rw-r--r--ev.pod12
3 files changed, 21 insertions, 1 deletions
diff --git a/ev.c b/ev.c
index 260787d..7e9423e 100644
--- a/ev.c
+++ b/ev.c
@@ -509,7 +509,8 @@ fd_event (EV_P_ int fd, int revents)
void
ev_feed_fd_event (EV_P_ int fd, int revents)
{
- fd_event (EV_A_ fd, revents);
+ if (fd >= 0 && fd < anfdmax)
+ fd_event (EV_A_ fd, revents);
}
void inline_size
@@ -1165,6 +1166,12 @@ ev_default_fork (void)
/*****************************************************************************/
+void
+ev_invoke (EV_P_ void *w, int revents)
+{
+ EV_CB_INVOKE ((W)w, revents);
+}
+
void inline_speed
call_pending (EV_P)
{
diff --git a/ev.h b/ev.h
index e92d6da..0652f1b 100644
--- a/ev.h
+++ b/ev.h
@@ -475,6 +475,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
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_invoke (EV_P_ void *w, int revents);
int ev_clear_pending (EV_P_ void *w);
void ev_io_start (EV_P_ ev_io *w);
diff --git a/ev.pod b/ev.pod
index a578fd8..ef9892e 100644
--- a/ev.pod
+++ b/ev.pod
@@ -779,6 +779,18 @@ Setting a priority outside the range of C<EV_MINPRI> to C<EV_MAXPRI> is
fine, as long as you do not mind that the priority value you query might
or might not have been adjusted to be within valid range.
+=item ev_invoke (loop, ev_TYPE *watcher, int revents)
+
+Invoke the C<watcher> with the given C<loop> and C<revents>. Neither
+C<loop> nor C<revents> need to be valid as long as the watcher callback
+can deal with that fact.
+
+=item int ev_clear_pending (loop, ev_TYPE *watcher)
+
+If the watcher is pending, this function returns clears its pending status
+and returns its C<revents> bitset (as if its callback was invoked). If the
+watcher isn't pending it does nothing and returns C<0>.
+
=back