X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/88e775bf263260736b416158fa5c27bece8644c0..f6cc1f750a321b2c6e30637963d3e624c7a8e5ae:/ev.3?ds=inline diff --git a/ev.3 b/ev.3 index 9e1c613..7c9695c 100644 --- a/ev.3 +++ b/ev.3 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title """ 1" -.TH "" 1 "2007-11-28" "perl v5.8.8" "User Contributed Perl Documentation" +.TH "" 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" @@ -413,6 +413,26 @@ or setgid) then libev will \fInot\fR look at the environment variable 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)" @@ -1073,23 +1093,25 @@ timer will not fire more than once per event loop iteration. 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.); @@ -1102,8 +1124,8 @@ and only ever use the \f(CW\*(C`repeat\*(C'\fR value: \& 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 @@ -1977,8 +1999,9 @@ suitable for use with \f(CW\*(C`EV_A\*(C'\fR. 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 @@ -2051,7 +2074,7 @@ in your include path (e.g. in libev/ when using \-Ilibev): .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) @@ -2288,13 +2311,18 @@ will be compiled. It is pretty complex because it provides its own header 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 +\& #define EV_MINPRI 0 +\& #define EV_MAXPRI 0 .Ve .Sp .Vb 1