From 44f698ae2a749d552fab07dd450d4085f8f83531 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 2 Apr 2008 06:34:50 +0000 Subject: *** empty log message *** --- Changes | 1 + ev.h | 2 ++ ev.pod | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/Changes b/Changes index 58cfabf..28d6f83 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for libev, a high-performance and full-featured event loop. - fix a 64 bit overflow issue in the select backend, by using fd_mask instead of int for the mask. - rename internal sighandler to avoid clash with very old perls. + - add ev_async_pending. 3.1 Thu Mar 13 13:45:22 CET 2008 - implement ev_async watchers. diff --git a/ev.h b/ev.h index 5a3d152..11b7cc2 100644 --- a/ev.h +++ b/ev.h @@ -326,6 +326,8 @@ typedef struct ev_async EV_ATOMIC_T sent; /* private */ } ev_async; + +# define ev_async_pending(w) (((w)->sent + 0) #endif /* the presence of this union forces similar struct layout */ diff --git a/ev.pod b/ev.pod index 81dd6a9..aa8a647 100644 --- a/ev.pod +++ b/ev.pod @@ -2290,6 +2290,20 @@ This call incurs the overhead of a syscall only once per loop iteration, so while the overhead might be noticable, it doesn't apply to repeated calls to C. +=item bool = ev_async_pending (ev_async *) + +Returns a non-zero value when C has been called on the +watcher but the event has not yet been processed (or even noted) by the +event loop. + +C sets a flag in the watcher and wakes up the loop. When +the loop iterates next and checks for the watcher to have become active, +it will reset the flag again. C can be used to very +quickly check wether invoking the loop might be a good idea. + +Not that this does I check wether the watcher itself is pending, only +wether it has been requested to make this watcher pending. + =back -- cgit v1.2.3