1 | libev is a high-performance event loop/event model with lots of features. |
1 | libev is a high-performance event loop/event model with lots of features. |
2 | (see benchmark at http://libev.schmorp.de/bench.html) |
2 | (see benchmark at http://libev.schmorp.de/bench.html) |
3 | |
3 | |
|
|
4 | |
|
|
5 | ABOUT |
|
|
6 | |
4 | Homepage: http://software.schmorp.de/pkg/libev |
7 | Homepage: http://software.schmorp.de/pkg/libev |
5 | E-Mail: libev@lists.schmorp.de |
8 | Mailinglist: libev@lists.schmorp.de |
|
|
9 | http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev |
|
|
10 | Library Documentation: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod |
6 | |
11 | |
7 | It is modelled (very losely) after libevent |
12 | Libev is modelled (very loosely) after libevent and the Event perl |
8 | (http://monkey.org/~provos/libevent/) and the Event perl module, but aims |
13 | module, but is faster, scales better and is more correct, and also more |
9 | to be faster and more correct, and also more featureful. |
14 | featureful. And also smaller. Yay. |
10 | |
15 | |
11 | ABOUT THIS DISTRIBUTION |
16 | Some of the specialties of libev not commonly found elsewhere are: |
|
|
17 | |
|
|
18 | - extensive and detailed, readable documentation (not doxygen garbage). |
|
|
19 | - fully supports fork, can detect fork in various ways and automatically |
|
|
20 | re-arms kernel mechanisms that do not support fork. |
|
|
21 | - highly optimised select, poll, linux epoll, linux aio, bsd kqueue |
|
|
22 | and solaris event ports backends. |
|
|
23 | - filesystem object (path) watching (with optional linux inotify support). |
|
|
24 | - wallclock-based times (using absolute time, cron-like). |
|
|
25 | - relative timers/timeouts (handle time jumps). |
|
|
26 | - fast intra-thread communication between multiple |
|
|
27 | event loops (with optional fast linux eventfd backend). |
|
|
28 | - extremely easy to embed (fully documented, no dependencies, |
|
|
29 | autoconf supported but optional). |
|
|
30 | - very small codebase, no bloated library, simple code. |
|
|
31 | - fully extensible by being able to plug into the event loop, |
|
|
32 | integrate other event loops, integrate other event loop users. |
|
|
33 | - very little memory use (small watchers, small event loop data). |
|
|
34 | - optional C++ interface allowing method and function callbacks |
|
|
35 | at no extra memory or runtime overhead. |
|
|
36 | - optional Perl interface with similar characteristics (capable |
|
|
37 | of running Glib/Gtk2 on libev). |
|
|
38 | - support for other languages (multiple C++ interfaces, D, Ruby, |
|
|
39 | Python) available from third-parties. |
12 | |
40 | |
13 | If you downloaded a distribution of libev, you will find it looks |
41 | Examples of programs that embed libev: the EV perl module, auditd, |
14 | very much like libevent. In fact, the distributed libev tarballs are |
42 | rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the Deliantra MMORPG |
15 | indeed libevent tarballs patched up with the libev event core, taking |
43 | server (http://www.deliantra.net/), Rubinius (a next-generation Ruby |
16 | the evbuffer, evtag, evdns and evhttpd parts from libevent (they use |
44 | VM), the Ebb web server, the Rev event toolkit. |
17 | the libevent emulation inside libev). Configure and Makefile stuff is |
|
|
18 | also a more or less direct copy of libevent, and are maintained by the |
|
|
19 | libevent authors. |
|
|
20 | |
45 | |
21 | If you are looking for an easily embeddable version, I recommend using |
|
|
22 | the CVS repository (linked from the homepage, above), which contains |
|
|
23 | only the libev core parts. |
|
|
24 | |
46 | |
25 | Examples of programs that embed libev: the EV perl module, |
47 | CONTRIBUTORS |
26 | rxvt-unicode, gvpe (GNU Virtual Private Ethernet) and deliantra |
|
|
27 | (http://www.deliantra.net). |
|
|
28 | |
|
|
29 | DIFFERENCES AND COMPARISON TO LIBEVENT |
|
|
30 | |
|
|
31 | The comparisons below are relative to libevent-1.3e. |
|
|
32 | |
|
|
33 | - multiple watchers can wait for the same event without deregistering others, |
|
|
34 | both for file descriptors as well as signals. |
|
|
35 | (registering two read events on fd 10 and unregistering one will not |
|
|
36 | break the other). |
|
|
37 | |
|
|
38 | - fork() is supported and can be handled |
|
|
39 | (there is no way to recover from a fork with libevent). |
|
|
40 | |
|
|
41 | - timers are handled as a priority queue (important operations are O(1)) |
|
|
42 | (libevent uses a much less efficient but more complex red-black tree). |
|
|
43 | |
|
|
44 | - supports absolute (wallclock-based) timers in addition to relative ones, |
|
|
45 | i.e. can schedule timers to occur after n seconds, or at a specific time. |
|
|
46 | |
|
|
47 | - timers can be repeating (both absolute and relative ones). |
|
|
48 | |
|
|
49 | - absolute timers can have customised rescheduling hooks (suitable for cron-like |
|
|
50 | applications). |
|
|
51 | |
|
|
52 | - detects time jumps and adjusts timers |
|
|
53 | (works for both forward and backward time jumps and also for absolute timers). |
|
|
54 | |
|
|
55 | - race-free signal processing |
|
|
56 | (libevent may delay processing signals till after the next event). |
|
|
57 | |
|
|
58 | - more efficient epoll backend |
|
|
59 | (stopping and starting an io watcher between two loop iterations will not |
|
|
60 | result in spurious epoll_ctl calls). |
|
|
61 | |
|
|
62 | - usually less calls to gettimeofday and clock_gettime |
|
|
63 | (libevent calls it on every timer event change, libev twice per iteration). |
|
|
64 | |
|
|
65 | - watchers use less memory |
|
|
66 | (libevent watcher on amd64: 152 bytes, libev native: <= 56 bytes, libevent emulation: 144 bytes). |
|
|
67 | |
|
|
68 | - library uses less memory |
|
|
69 | (libevent allocates large data structures wether used or not, libev |
|
|
70 | scales all its data structures dynamically). |
|
|
71 | |
|
|
72 | - no hardcoded arbitrary limits |
|
|
73 | (libevent contains an off-by-one bug and sometimes hardcodes limits). |
|
|
74 | |
|
|
75 | - libev separates timer, signal and io watchers from each other |
|
|
76 | (libevent combines them, but with libev you can combine them yourself |
|
|
77 | by reusing the same callback and still save memory). |
|
|
78 | |
|
|
79 | - simpler design, backends are potentially much simpler |
|
|
80 | (in libevent, backends have to deal with watchers, thus the problems with |
|
|
81 | wildly different semantics between diferent backends) |
|
|
82 | (epoll backend in libevent: 366 lines no caching, libev: 90 lines full caching). |
|
|
83 | |
|
|
84 | - libev handles EBADF gracefully by removing the offending fds. |
|
|
85 | |
|
|
86 | - libev communicates errors to the callback, libevent to the |
|
|
87 | event adder or not at all. |
|
|
88 | |
|
|
89 | - doesn't rely on nonportable BSD header files. |
|
|
90 | |
|
|
91 | - an event.h compatibility header exists, and can be used to run a wide |
|
|
92 | range of libevent programs unchanged (such as evdns.c). |
|
|
93 | |
|
|
94 | - win32 compatibility for the core parts. |
|
|
95 | (the backend is fd-based as documented and on other platforms, |
|
|
96 | not handle-based like libevent, and can be used for both winscoket environments |
|
|
97 | and unix-like ones). |
|
|
98 | |
|
|
99 | - libev can be embedded easily with or without autoconf support into |
|
|
100 | other programs, with no changes to the source code necessary. |
|
|
101 | |
|
|
102 | - the event core library (ev and event layer) compiles and works both as |
|
|
103 | C and C++. |
|
|
104 | |
|
|
105 | - a simple C++ wrapper that supports methods as callbacks exists. |
|
|
106 | |
|
|
107 | - a full featured and widely used perl module is available. |
|
|
108 | |
|
|
109 | whats missing? |
|
|
110 | |
|
|
111 | - no event-like priority support at the moment (the ev priorities work |
|
|
112 | differently, but you can use idle watchers to get a similar effect). |
|
|
113 | |
|
|
114 | AUTHOR |
|
|
115 | |
48 | |
116 | libev was written and designed by Marc Lehmann and Emanuele Giaquinta. |
49 | libev was written and designed by Marc Lehmann and Emanuele Giaquinta. |
117 | |
50 | |
118 | The following people sent in patches or made other noteworthy |
51 | The following people sent in patches or made other noteworthy |
119 | contributions to the design (if I forgot to include you, please shout |
52 | contributions to the design (for minor patches, see the Changes |
120 | at me, it was an accident): |
53 | file. If I forgot to include you, please shout at me, it was an |
|
|
54 | accident): |
121 | |
55 | |
122 | W.C.A. Wijngaards |
56 | W.C.A. Wijngaards |
123 | Christopher Layne |
57 | Christopher Layne |
124 | Chris Brody |
58 | Chris Brody |
125 | |
59 | |