1 |
root |
1.1 |
libev is modelled after libevent (http://monkey.org/~provos/libevent/), but aims |
2 |
|
|
to be faster and more correct, and also more featureful. Examples: |
3 |
|
|
|
4 |
root |
1.4 |
- multiple watchers can wait for the same event without deregistering others, |
5 |
|
|
both for file descriptors as well as signals. |
6 |
root |
1.2 |
(registering two read events on fd 10 and unregistering one will not |
7 |
|
|
break the other) |
8 |
|
|
|
9 |
|
|
- fork() is supported and can be handled |
10 |
|
|
(there is no way to recover from a fork when libevent is active) |
11 |
|
|
|
12 |
|
|
- timers are handled as a priority queue |
13 |
|
|
(libevent uses a less efficient red-black tree) |
14 |
|
|
|
15 |
|
|
- supports absolute (wallclock-based) timers in addition to relative ones, |
16 |
|
|
i.e. can schedule timers to occur after n seconds, or at a specific time. |
17 |
|
|
|
18 |
|
|
- timers can be repeating (both absolute and relative ones) |
19 |
|
|
|
20 |
|
|
- detects time jumps and adjusts timers |
21 |
|
|
(works for both forward and backward time jumps and also for absolute timers) |
22 |
|
|
|
23 |
|
|
- can correctly remove timers while executing callbacks |
24 |
|
|
(libevent doesn't handle this reliably and can crash) |
25 |
|
|
|
26 |
root |
1.3 |
- race-free signal processing |
27 |
|
|
(libevent may delay processing signals till after the next event) |
28 |
|
|
|
29 |
root |
1.2 |
- less calls to epoll_ctl |
30 |
|
|
(stopping and starting an io watcher between two loop iterations will now |
31 |
|
|
result in spuriois epoll_ctl calls) |
32 |
|
|
|
33 |
|
|
- usually less calls to gettimeofday and clock_gettime |
34 |
|
|
(libevent calls it on every timer event change, libev twice per iteration) |
35 |
|
|
|
36 |
|
|
- watchers use less memory |
37 |
|
|
(libevent on amd64: 152 bytes, libev: <= 56 bytes) |
38 |
|
|
|
39 |
|
|
- library uses less memory |
40 |
|
|
(libevent allocates large data structures wether used or not, libev |
41 |
|
|
scales all its data structures dynamically) |
42 |
|
|
|
43 |
|
|
- no hardcoded arbitrary limits |
44 |
|
|
(libevent contains an off-by-one bug and sometimes hardcodes a limit of |
45 |
|
|
32000 fds) |
46 |
|
|
|
47 |
|
|
- libev separates timer, signal and io watchers from each other |
48 |
|
|
(libevent combines them, but with libev you can combine them yourself |
49 |
|
|
by reusing the same callback and still save memory) |
50 |
|
|
|
51 |
|
|
- simpler design, backends are potentially much simpler |
52 |
|
|
(in libevent, backends have to deal with watchers, thus the problems) |
53 |
|
|
(epoll backend in libevent: 366 lines, libev: 89 lines, and more features) |
54 |
|
|
|
55 |
|
|
whats missing? |
56 |
|
|
|
57 |
|
|
- evdns, evhttp, bufferevent are missing, libev is only an even library at |
58 |
|
|
the moment. |
59 |
|
|
|
60 |
root |
1.4 |
- no priority support at the moment |
61 |
root |
1.2 |
|
62 |
root |
1.4 |
- kqueue, poll (libev currently implements epoll and select) |
63 |
|
|
|
64 |
|
|
- windows support (whats windows?) |
65 |
root |
1.1 |
|