… | |
… | |
411 | or setgid) then libev will \fInot\fR look at the environment variable |
411 | or setgid) then libev will \fInot\fR look at the environment variable |
412 | \&\f(CW\*(C`LIBEV_FLAGS\*(C'\fR. Otherwise (the default), this environment variable will |
412 | \&\f(CW\*(C`LIBEV_FLAGS\*(C'\fR. Otherwise (the default), this environment variable will |
413 | override the flags completely if it is found in the environment. This is |
413 | override the flags completely if it is found in the environment. This is |
414 | useful to try out specific backends to test their performance, or to work |
414 | useful to try out specific backends to test their performance, or to work |
415 | around bugs. |
415 | around bugs. |
|
|
416 | .ie n .IP """EVFLAG_FORKCHECK""" 4 |
|
|
417 | .el .IP "\f(CWEVFLAG_FORKCHECK\fR" 4 |
|
|
418 | .IX Item "EVFLAG_FORKCHECK" |
|
|
419 | Instead of calling \f(CW\*(C`ev_default_fork\*(C'\fR or \f(CW\*(C`ev_loop_fork\*(C'\fR manually after |
|
|
420 | a fork, you can also make libev check for a fork in each iteration by |
|
|
421 | enabling this flag. |
|
|
422 | .Sp |
|
|
423 | This works by calling \f(CW\*(C`getpid ()\*(C'\fR on every iteration of the loop, |
|
|
424 | and thus this might slow down your event loop if you do a lot of loop |
|
|
425 | iterations and little real work, but is usually not noticable (on my |
|
|
426 | Linux system for example, \f(CW\*(C`getpid\*(C'\fR is actually a simple 5\-insn sequence |
|
|
427 | without a syscall and thus \fIvery\fR fast, but my Linux system also has |
|
|
428 | \&\f(CW\*(C`pthread_atfork\*(C'\fR which is even faster). |
|
|
429 | .Sp |
|
|
430 | The big advantage of this flag is that you can forget about fork (and |
|
|
431 | forget about forgetting to tell libev about forking) when you use this |
|
|
432 | flag. |
|
|
433 | .Sp |
|
|
434 | This flag setting cannot be overriden or specified in the \f(CW\*(C`LIBEV_FLAGS\*(C'\fR |
|
|
435 | environment variable. |
416 | .ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4 |
436 | .ie n .IP """EVBACKEND_SELECT"" (value 1, portable select backend)" 4 |
417 | .el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4 |
437 | .el .IP "\f(CWEVBACKEND_SELECT\fR (value 1, portable select backend)" 4 |
418 | .IX Item "EVBACKEND_SELECT (value 1, portable select backend)" |
438 | .IX Item "EVBACKEND_SELECT (value 1, portable select backend)" |
419 | This is your standard \fIselect\fR\|(2) backend. Not \fIcompletely\fR standard, as |
439 | This is your standard \fIselect\fR\|(2) backend. Not \fIcompletely\fR standard, as |
420 | libev tries to roll its own fd_set with no limits on the number of fds, |
440 | libev tries to roll its own fd_set with no limits on the number of fds, |
… | |
… | |
1977 | .el .IP "\f(CWEV_DEFAULT\fR, \f(CWEV_DEFAULT_\fR" 4 |
1997 | .el .IP "\f(CWEV_DEFAULT\fR, \f(CWEV_DEFAULT_\fR" 4 |
1978 | .IX Item "EV_DEFAULT, EV_DEFAULT_" |
1998 | .IX Item "EV_DEFAULT, EV_DEFAULT_" |
1979 | Similar to the other two macros, this gives you the value of the default |
1999 | Similar to the other two macros, this gives you the value of the default |
1980 | loop, if multiple loops are supported (\*(L"ev loop default\*(R"). |
2000 | loop, if multiple loops are supported (\*(L"ev loop default\*(R"). |
1981 | .PP |
2001 | .PP |
1982 | Example: Declare and initialise a check watcher, working regardless of |
2002 | Example: Declare and initialise a check watcher, utilising the above |
1983 | wether multiple loops are supported or not. |
2003 | macros so it will work regardless of wether multiple loops are supported |
|
|
2004 | or not. |
1984 | .PP |
2005 | .PP |
1985 | .Vb 5 |
2006 | .Vb 5 |
1986 | \& static void |
2007 | \& static void |
1987 | \& check_cb (EV_P_ ev_timer *w, int revents) |
2008 | \& check_cb (EV_P_ ev_timer *w, int revents) |
1988 | \& { |
2009 | \& { |
… | |
… | |
2051 | .Vb 1 |
2072 | .Vb 1 |
2052 | \& ev_win32.c required on win32 platforms only |
2073 | \& ev_win32.c required on win32 platforms only |
2053 | .Ve |
2074 | .Ve |
2054 | .PP |
2075 | .PP |
2055 | .Vb 5 |
2076 | .Vb 5 |
2056 | \& ev_select.c only when select backend is enabled (which is by default) |
2077 | \& ev_select.c only when select backend is enabled (which is enabled by default) |
2057 | \& ev_poll.c only when poll backend is enabled (disabled by default) |
2078 | \& ev_poll.c only when poll backend is enabled (disabled by default) |
2058 | \& ev_epoll.c only when the epoll backend is enabled (disabled by default) |
2079 | \& ev_epoll.c only when the epoll backend is enabled (disabled by default) |
2059 | \& ev_kqueue.c only when the kqueue backend is enabled (disabled by default) |
2080 | \& ev_kqueue.c only when the kqueue backend is enabled (disabled by default) |
2060 | \& ev_port.c only when the solaris port backend is enabled (disabled by default) |
2081 | \& ev_port.c only when the solaris port backend is enabled (disabled by default) |
2061 | .Ve |
2082 | .Ve |
… | |
… | |
2288 | interface) and \fI\s-1EV\s0.xs\fR (implementation) files. Only the \fI\s-1EV\s0.xs\fR file |
2309 | interface) and \fI\s-1EV\s0.xs\fR (implementation) files. Only the \fI\s-1EV\s0.xs\fR file |
2289 | will be compiled. It is pretty complex because it provides its own header |
2310 | will be compiled. It is pretty complex because it provides its own header |
2290 | file. |
2311 | file. |
2291 | .Sp |
2312 | .Sp |
2292 | The usage in rxvt-unicode is simpler. It has a \fIev_cpp.h\fR header file |
2313 | The usage in rxvt-unicode is simpler. It has a \fIev_cpp.h\fR header file |
2293 | that everybody includes and which overrides some autoconf choices: |
2314 | that everybody includes and which overrides some configure choices: |
2294 | .Sp |
2315 | .Sp |
2295 | .Vb 4 |
2316 | .Vb 9 |
|
|
2317 | \& #define EV_MINIMAL 1 |
2296 | \& #define EV_USE_POLL 0 |
2318 | \& #define EV_USE_POLL 0 |
2297 | \& #define EV_MULTIPLICITY 0 |
2319 | \& #define EV_MULTIPLICITY 0 |
2298 | \& #define EV_PERIODICS 0 |
2320 | \& #define EV_PERIODIC_ENABLE 0 |
|
|
2321 | \& #define EV_STAT_ENABLE 0 |
|
|
2322 | \& #define EV_FORK_ENABLE 0 |
2299 | \& #define EV_CONFIG_H <config.h> |
2323 | \& #define EV_CONFIG_H <config.h> |
|
|
2324 | \& #define EV_MINPRI 0 |
|
|
2325 | \& #define EV_MAXPRI 0 |
2300 | .Ve |
2326 | .Ve |
2301 | .Sp |
2327 | .Sp |
2302 | .Vb 1 |
2328 | .Vb 1 |
2303 | \& #include "ev++.h" |
2329 | \& #include "ev++.h" |
2304 | .Ve |
2330 | .Ve |