… | |
… | |
331 | |
331 | |
332 | =item C<EVBACKEND_KQUEUE> (value 8, most BSD clones) |
332 | =item C<EVBACKEND_KQUEUE> (value 8, most BSD clones) |
333 | |
333 | |
334 | Kqueue deserves special mention, as at the time of this writing, it |
334 | Kqueue deserves special mention, as at the time of this writing, it |
335 | was broken on all BSDs except NetBSD (usually it doesn't work with |
335 | was broken on all BSDs except NetBSD (usually it doesn't work with |
336 | anything but sockets and pipes, except on Darwin, where of course its |
336 | anything but sockets and pipes, except on Darwin, where of course it's |
337 | completely useless). For this reason its not being "autodetected" |
337 | completely useless). For this reason it's not being "autodetected" |
338 | unless you explicitly specify it explicitly in the flags (i.e. using |
338 | unless you explicitly specify it explicitly in the flags (i.e. using |
339 | C<EVBACKEND_KQUEUE>). |
339 | C<EVBACKEND_KQUEUE>). |
340 | |
340 | |
341 | It scales in the same way as the epoll backend, but the interface to the |
341 | It scales in the same way as the epoll backend, but the interface to the |
342 | kernel is more efficient (which says nothing about its actual speed, of |
342 | kernel is more efficient (which says nothing about its actual speed, of |
… | |
… | |
404 | Destroys the default loop again (frees all memory and kernel state |
404 | Destroys the default loop again (frees all memory and kernel state |
405 | etc.). None of the active event watchers will be stopped in the normal |
405 | etc.). None of the active event watchers will be stopped in the normal |
406 | sense, so e.g. C<ev_is_active> might still return true. It is your |
406 | sense, so e.g. C<ev_is_active> might still return true. It is your |
407 | responsibility to either stop all watchers cleanly yoursef I<before> |
407 | responsibility to either stop all watchers cleanly yoursef I<before> |
408 | calling this function, or cope with the fact afterwards (which is usually |
408 | calling this function, or cope with the fact afterwards (which is usually |
409 | the easiest thing, youc na just ignore the watchers and/or C<free ()> them |
409 | the easiest thing, you can just ignore the watchers and/or C<free ()> them |
410 | for example). |
410 | for example). |
|
|
411 | |
|
|
412 | Note that certain global state, such as signal state, will not be freed by |
|
|
413 | this function, and related watchers (such as signal and child watchers) |
|
|
414 | would need to be stopped manually. |
|
|
415 | |
|
|
416 | In general it is not advisable to call this function except in the |
|
|
417 | rare occasion where you really need to free e.g. the signal handling |
|
|
418 | pipe fds. If you need dynamically allocated loops it is better to use |
|
|
419 | C<ev_loop_new> and C<ev_loop_destroy>). |
411 | |
420 | |
412 | =item ev_loop_destroy (loop) |
421 | =item ev_loop_destroy (loop) |
413 | |
422 | |
414 | Like C<ev_default_destroy>, but destroys an event loop created by an |
423 | Like C<ev_default_destroy>, but destroys an event loop created by an |
415 | earlier call to C<ev_loop_new>. |
424 | earlier call to C<ev_loop_new>. |
… | |
… | |
1782 | |
1791 | |
1783 | Make a single, non-blocking sweep over the embedded loop. This works |
1792 | Make a single, non-blocking sweep over the embedded loop. This works |
1784 | similarly to C<ev_loop (embedded_loop, EVLOOP_NONBLOCK)>, but in the most |
1793 | similarly to C<ev_loop (embedded_loop, EVLOOP_NONBLOCK)>, but in the most |
1785 | apropriate way for embedded loops. |
1794 | apropriate way for embedded loops. |
1786 | |
1795 | |
1787 | =item struct ev_loop *loop [read-only] |
1796 | =item struct ev_loop *other [read-only] |
1788 | |
1797 | |
1789 | The embedded event loop. |
1798 | The embedded event loop. |
1790 | |
1799 | |
1791 | =back |
1800 | =back |
1792 | |
1801 | |
… | |
… | |
2131 | Libev can (and often is) directly embedded into host |
2140 | Libev can (and often is) directly embedded into host |
2132 | applications. Examples of applications that embed it include the Deliantra |
2141 | applications. Examples of applications that embed it include the Deliantra |
2133 | Game Server, the EV perl module, the GNU Virtual Private Ethernet (gvpe) |
2142 | Game Server, the EV perl module, the GNU Virtual Private Ethernet (gvpe) |
2134 | and rxvt-unicode. |
2143 | and rxvt-unicode. |
2135 | |
2144 | |
2136 | The goal is to enable you to just copy the neecssary files into your |
2145 | The goal is to enable you to just copy the necessary files into your |
2137 | source directory without having to change even a single line in them, so |
2146 | source directory without having to change even a single line in them, so |
2138 | you can easily upgrade by simply copying (or having a checked-out copy of |
2147 | you can easily upgrade by simply copying (or having a checked-out copy of |
2139 | libev somewhere in your source tree). |
2148 | libev somewhere in your source tree). |
2140 | |
2149 | |
2141 | =head2 FILESETS |
2150 | =head2 FILESETS |
… | |
… | |
2241 | |
2250 | |
2242 | If defined to be C<1>, libev will try to detect the availability of the |
2251 | If defined to be C<1>, libev will try to detect the availability of the |
2243 | realtime clock option at compiletime (and assume its availability at |
2252 | realtime clock option at compiletime (and assume its availability at |
2244 | runtime if successful). Otherwise no use of the realtime clock option will |
2253 | runtime if successful). Otherwise no use of the realtime clock option will |
2245 | be attempted. This effectively replaces C<gettimeofday> by C<clock_get |
2254 | be attempted. This effectively replaces C<gettimeofday> by C<clock_get |
2246 | (CLOCK_REALTIME, ...)> and will not normally affect correctness. See tzhe note about libraries |
2255 | (CLOCK_REALTIME, ...)> and will not normally affect correctness. See the |
2247 | in the description of C<EV_USE_MONOTONIC>, though. |
2256 | note about libraries in the description of C<EV_USE_MONOTONIC>, though. |
2248 | |
2257 | |
2249 | =item EV_USE_SELECT |
2258 | =item EV_USE_SELECT |
2250 | |
2259 | |
2251 | If undefined or defined to be C<1>, libev will compile in support for the |
2260 | If undefined or defined to be C<1>, libev will compile in support for the |
2252 | C<select>(2) backend. No attempt at autodetection will be done: if no |
2261 | C<select>(2) backend. No attempt at autodetection will be done: if no |
… | |
… | |
2436 | definition and a statement, respectively. See the F<ev.v> header file for |
2445 | definition and a statement, respectively. See the F<ev.v> header file for |
2437 | their default definitions. One possible use for overriding these is to |
2446 | their default definitions. One possible use for overriding these is to |
2438 | avoid the C<struct ev_loop *> as first argument in all cases, or to use |
2447 | avoid the C<struct ev_loop *> as first argument in all cases, or to use |
2439 | method calls instead of plain function calls in C++. |
2448 | method calls instead of plain function calls in C++. |
2440 | |
2449 | |
|
|
2450 | =head2 EXPORTED API SYMBOLS |
|
|
2451 | |
|
|
2452 | If you need to re-export the API (e.g. via a dll) and you need a list of |
|
|
2453 | exported symbols, you can use the provided F<Symbol.*> files which list |
|
|
2454 | all public symbols, one per line: |
|
|
2455 | |
|
|
2456 | Symbols.ev for libev proper |
|
|
2457 | Symbols.event for the libevent emulation |
|
|
2458 | |
|
|
2459 | This can also be used to rename all public symbols to avoid clashes with |
|
|
2460 | multiple versions of libev linked together (which is obviously bad in |
|
|
2461 | itself, but sometimes it is inconvinient to avoid this). |
|
|
2462 | |
|
|
2463 | A sed comamnd like this will create wrapper C<#define>'s that you need to |
|
|
2464 | include before including F<ev.h>: |
|
|
2465 | |
|
|
2466 | <Symbols.ev sed -e "s/.*/#define & myprefix_&/" >wrap.h |
|
|
2467 | |
|
|
2468 | This would create a file F<wrap.h> which essentially looks like this: |
|
|
2469 | |
|
|
2470 | #define ev_backend myprefix_ev_backend |
|
|
2471 | #define ev_check_start myprefix_ev_check_start |
|
|
2472 | #define ev_check_stop myprefix_ev_check_stop |
|
|
2473 | ... |
|
|
2474 | |
2441 | =head2 EXAMPLES |
2475 | =head2 EXAMPLES |
2442 | |
2476 | |
2443 | For a real-world example of a program the includes libev |
2477 | For a real-world example of a program the includes libev |
2444 | verbatim, you can have a look at the EV perl module |
2478 | verbatim, you can have a look at the EV perl module |
2445 | (L<http://software.schmorp.de/pkg/EV.html>). It has the libev files in |
2479 | (L<http://software.schmorp.de/pkg/EV.html>). It has the libev files in |