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