--- libev/ev.pod 2007/11/29 12:21:05 1.61 +++ libev/ev.pod 2007/12/03 13:41:25 1.66 @@ -268,6 +268,26 @@ useful to try out specific backends to test their performance, or to work around bugs. +=item C + +Instead of calling C or C manually after +a fork, you can also make libev check for a fork in each iteration by +enabling this flag. + +This works by calling C on every iteration of the loop, +and thus this might slow down your event loop if you do a lot of loop +iterations and little real work, but is usually not noticeable (on my +Linux system for example, C is actually a simple 5-insn sequence +without a syscall and thus I fast, but my Linux system also has +C which is even faster). + +The big advantage of this flag is that you can forget about fork (and +forget about forgetting to tell libev about forking) when you use this +flag. + +This flag setting cannot be overriden or specified in the C +environment variable. + =item C (value 1, portable select backend) This is your standard select(2) backend. Not I standard, as @@ -412,6 +432,16 @@ C. Yes, you have to call this on every allocated event loop after fork, and how you do this is entirely your own problem. +=item unsigned int ev_loop_count (loop) + +Returns the count of loop iterations for the loop, which is identical to +the number of times libev did poll for new events. It starts at C<0> and +happily wraps around with enough iterations. + +This value can sometimes be useful as a generation counter of sorts (it +"ticks" the number of loop iterations), as it roughly corresponds with +C and C calls. + =item unsigned int ev_backend (loop) Returns one of the C flags indicating the event backend in @@ -1439,7 +1469,8 @@ static void adns_prepare_cb (ev_loop *loop, ev_prepare *w, int revents) { - int timeout = 3600000;truct pollfd fds [nfd]; + int timeout = 3600000; + struct pollfd fds [nfd]; // actual code will need to loop here and realloc etc. adns_beforepoll (ads, fds, &nfd, &timeout, timeval_from (ev_time ())); @@ -1830,8 +1861,9 @@ =back -Example: Declare and initialise a check watcher, working regardless of -wether multiple loops are supported or not. +Example: Declare and initialise a check watcher, utilising the above +macros so it will work regardless of wether multiple loops are supported +or not. static void check_cb (EV_P_ ev_timer *w, int revents) @@ -1844,7 +1876,6 @@ ev_check_start (EV_DEFAULT_ &check); ev_loop (EV_DEFAULT_ 0); - =head1 EMBEDDING Libev can (and often is) directly embedded into host @@ -1893,7 +1924,7 @@ ev_win32.c required on win32 platforms only - ev_select.c only when select backend is enabled (which is by default) + ev_select.c only when select backend is enabled (which is enabled by default) ev_poll.c only when poll backend is enabled (disabled by default) ev_epoll.c only when the epoll backend is enabled (disabled by default) ev_kqueue.c only when the kqueue backend is enabled (disabled by default) @@ -2145,12 +2176,17 @@ file. The usage in rxvt-unicode is simpler. It has a F header file -that everybody includes and which overrides some autoconf choices: +that everybody includes and which overrides some configure choices: + #define EV_MINIMAL 1 #define EV_USE_POLL 0 #define EV_MULTIPLICITY 0 - #define EV_PERIODICS 0 + #define EV_PERIODIC_ENABLE 0 + #define EV_STAT_ENABLE 0 + #define EV_FORK_ENABLE 0 #define EV_CONFIG_H + #define EV_MINPRI 0 + #define EV_MAXPRI 0 #include "ev++.h"