.\" ========================================================================
.\"
.IX Title ""<STANDARD INPUT>" 1"
-.TH "<STANDARD INPUT>" 1 "2007-11-28" "perl v5.8.8" "User Contributed Perl Documentation"
+.TH "<STANDARD INPUT>" 1 "2007-11-29" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
libev \- a high performance full\-featured event loop written in C
.SH "SYNOPSIS"
override the flags completely if it is found in the environment. This is
useful to try out specific backends to test their performance, or to work
around bugs.
+.ie n .IP """EVFLAG_FORKCHECK""" 4
+.el .IP "\f(CWEVFLAG_FORKCHECK\fR" 4
+.IX Item "EVFLAG_FORKCHECK"
+Instead of calling \f(CW\*(C`ev_default_fork\*(C'\fR or \f(CW\*(C`ev_loop_fork\*(C'\fR manually after
+a fork, you can also make libev check for a fork in each iteration by
+enabling this flag.
+.Sp
+This works by calling \f(CW\*(C`getpid ()\*(C'\fR 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 noticable (on my
+Linux system for example, \f(CW\*(C`getpid\*(C'\fR is actually a simple 5\-insn sequence
+without a syscall and thus \fIvery\fR fast, but my Linux system also has
+\&\f(CW\*(C`pthread_atfork\*(C'\fR which is even faster).
+.Sp
+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.
+.Sp
+This flag setting cannot be overriden or specified in the \f(CW\*(C`LIBEV_FLAGS\*(C'\fR
+environment variable.
.ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4
.el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4
.IX Item "EVBACKEND_SELECT (value 1, portable select backend)"
This will act as if the timer timed out and restart it again if it is
repeating. The exact semantics are:
.Sp
-If the timer is started but nonrepeating, stop it.
+If the timer is pending, its pending status is cleared.
.Sp
-If the timer is repeating, either start it if necessary (with the repeat
-value), or reset the running timer to the repeat value.
+If the timer is started but nonrepeating, stop it (as if it timed out).
+.Sp
+If the timer is repeating, either start it if necessary (with the
+\&\f(CW\*(C`repeat\*(C'\fR value), or reset the running timer to the \f(CW\*(C`repeat\*(C'\fR value.
.Sp
This sounds a bit complicated, but here is a useful and typical
-example: Imagine you have a tcp connection and you want a so-called
-idle timeout, that is, you want to be called when there have been,
-say, 60 seconds of inactivity on the socket. The easiest way to do
-this is to configure an \f(CW\*(C`ev_timer\*(C'\fR with \f(CW\*(C`after\*(C'\fR=\f(CW\*(C`repeat\*(C'\fR=\f(CW60\fR and calling
+example: Imagine you have a tcp connection and you want a so-called idle
+timeout, that is, you want to be called when there have been, say, 60
+seconds of inactivity on the socket. The easiest way to do this is to
+configure an \f(CW\*(C`ev_timer\*(C'\fR with a \f(CW\*(C`repeat\*(C'\fR value of \f(CW60\fR and then call
\&\f(CW\*(C`ev_timer_again\*(C'\fR each time you successfully read or write some data. If
you go into an idle state where you do not expect data to travel on the
-socket, you can stop the timer, and again will automatically restart it if
-need be.
+socket, you can \f(CW\*(C`ev_timer_stop\*(C'\fR the timer, and \f(CW\*(C`ev_timer_again\*(C'\fR will
+automatically restart it if need be.
.Sp
-You can also ignore the \f(CW\*(C`after\*(C'\fR value and \f(CW\*(C`ev_timer_start\*(C'\fR altogether
-and only ever use the \f(CW\*(C`repeat\*(C'\fR value:
+That means you can ignore the \f(CW\*(C`after\*(C'\fR value and \f(CW\*(C`ev_timer_start\*(C'\fR
+altogether and only ever use the \f(CW\*(C`repeat\*(C'\fR value and \f(CW\*(C`ev_timer_again\*(C'\fR:
.Sp
.Vb 8
\& ev_timer_init (timer, callback, 0., 5.);
\& ev_timer_again (loop, timer);
.Ve
.Sp
-This is more efficient then stopping/starting the timer eahc time you want
-to modify its timeout value.
+This is more slightly efficient then stopping/starting the timer each time
+you want to modify its timeout value.
.IP "ev_tstamp repeat [read\-write]" 4
.IX Item "ev_tstamp repeat [read-write]"
The current \f(CW\*(C`repeat\*(C'\fR value. Will be used each time the watcher times out
Similar to the other two macros, this gives you the value of the default
loop, if multiple loops are supported (\*(L"ev loop default\*(R").
.PP
-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.
.PP
.Vb 5
\& static void
.Ve
.PP
.Vb 5
-\& 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)
file.
.Sp
The usage in rxvt-unicode is simpler. It has a \fIev_cpp.h\fR header file
-that everybody includes and which overrides some autoconf choices:
+that everybody includes and which overrides some configure choices:
.Sp
-.Vb 4
+.Vb 9
+\& #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 <config.h>
+\& #define EV_MINPRI 0
+\& #define EV_MAXPRI 0
.Ve
.Sp
.Vb 1