OLD | NEW |
| (Empty) |
1 What's New In Libevent 1.4: | |
2 | |
3 0. About this document | |
4 | |
5 This document describes the key differences between Libevent 1.3 and | |
6 Libevent 1.4, from a user's point of view. It was most recently | |
7 updated based on features from libevent 1.4.2-rc. | |
8 | |
9 1. Packaging Issues. | |
10 | |
11 1.1. The great library division. | |
12 | |
13 The libevent source now builds two libraries: libevent_core and | |
14 libevent_extra. The libevent_core library includes event loops, | |
15 timers, buffer code, and various small compatibility functions. The | |
16 libevent_extra library includes code for HTTP, DNS, RPC, and so on. | |
17 Thus, if you're writing software that only uses libevent's event | |
18 loop, you should link against only the libevent_core library, | |
19 whereas if you're writing software that uses libevent's protocol | |
20 support as well, you need to link libevent_extra as well. | |
21 | |
22 For backward compatibility, libevent also builds a library called | |
23 "libevent" that includes everything. | |
24 | |
25 1.2. The event-config.h header | |
26 | |
27 Libevent configure script now builds two headers from its configure | |
28 script: config.h (which it uses internally) and event-config.h | |
29 (which it installs as a header file). All of the macros in | |
30 event-config.h are modified so that they're safe to include in other | |
31 projects. This allows libevent's header files (like event.h and | |
32 evutil.h) information about platform configuration. | |
33 | |
34 What does this mean for you? As of 1.4.x, it should never be | |
35 necessary to include extra files or define extra types before you | |
36 include event.h (or any other libevent header); event.h can now look | |
37 at the information in event-config.h and figure out what it needs to | |
38 include. | |
39 | |
40 1.3. Documentation | |
41 | |
42 Libevent now includes better doxygen documentation. It's not | |
43 perfect or complete, though; if you find a mistake, please let us | |
44 know. | |
45 | |
46 1.4. Libtool usage | |
47 | |
48 We now use libtool's library versioning support correctly. If we | |
49 don't mess this up, it means that binaries linked against old | |
50 version of libevent should continue working when we make changes to | |
51 libevent that don't break backward compatibility. | |
52 | |
53 1.5. Portability | |
54 | |
55 Libevent now builds with MSVC again. We've only tested it with MSVC | |
56 2005, and the project files might not be right. Please let us know | |
57 if you run into any issues. | |
58 | |
59 Libevent now builds on platforms where /bin/sh is not bash. | |
60 | |
61 Libevent's regression test no longer requires Python to be | |
62 installed. | |
63 | |
64 2. New and Improved APIs: | |
65 | |
66 (This list includes functions that are new, functions whose behavior | |
67 has changed, and functions that were included in previous releases | |
68 but which never actually worked before.) | |
69 | |
70 2.1. Utility functions are defined in evutil.h | |
71 | |
72 Libevent now exposes a small set of functions for cross-platform | |
73 network programming in evutil.h, on the theory that they've been | |
74 useful enough to us that other people may likely want to use them | |
75 too. These are mainly workarounds for Windows issues for now: they | |
76 include evutil_socketpair (to fake socketpair on platforms that | |
77 don't have it) and evutil_make_socket_nonblocking (to make a socket | |
78 nonblocking in a cross-platform way. See the header for more | |
79 information. | |
80 | |
81 2.2. In the libevent core. | |
82 | |
83 The event_base_free() function now works. Previously, it would | |
84 crash with an assertion failure if there were events pending on a | |
85 base. Now, it simply deletes all the pending events and frees the | |
86 base. Be careful -- this might leak fds and memory associated with | |
87 the old events. To avoid leaks, you should still remove all the | |
88 events and free their resources before you delete the base. | |
89 | |
90 Libevent should now work properly with fork(). Just call | |
91 event_reinit() on your event base after the fork call, and it should | |
92 work okay. Please let us know about any bugs you find. | |
93 | |
94 There's a new event_base_new() function that acts just like | |
95 event_init(), but does not replace the default base. If you are | |
96 using multiple event bases in your code, you should just use | |
97 event_base_new() instead of event_init(), to avoid accidental bugs. | |
98 | |
99 There's new event_loopbreak() function to make a current event loop | |
100 stop exiting and return. Unlike event_loopexit, it stops subsequent | |
101 pending events from getting executed. This behavior is useful for | |
102 scripting languages to implement exceptions from inside callbacks. | |
103 | |
104 There's a new event_base_get_method() function, for use in place of | |
105 event_get_method() in multi-base applications. | |
106 | |
107 2.3. New in HTTP. | |
108 | |
109 There's an evhttp_connection_set_local_address() function you can | |
110 use to set the local address of an HTTP connection. | |
111 | |
112 HTTP/1.1 chunking now correctly ends chunks with '\r\n'. | |
113 | |
114 2.4. New in DNS | |
115 | |
116 Instead of picking your method for generating DNS transaction IDs at | |
117 startup, you can use evdns_set_transaction_id() to provide a | |
118 transaction ID function at runtime. | |
119 | |
120 The "class" field in evdns_server_request is now renamed to | |
121 dns_question_class, so that it won't break compilation under C++. | |
122 This uses some preprocessor hacks so that C code using the old name | |
123 won't break. Eventually, the old name will be deprecated entirely; | |
124 please don't use it. | |
125 | |
126 2.5. New in RPC | |
127 | |
128 There are now hooks on RPC input and output; can be used to | |
129 implement RPC independent processing such as compression or | |
130 authentication. | |
131 | |
132 RPC tags can now be up to 32 bits. This is wire-compatible, but | |
133 changes some of the types in the APIs. Please let us know if this | |
134 is problematic for you. | |
135 | |
136 3. Big bugfixes | |
137 | |
138 We've done a lot, with help from users on different platforms, to | |
139 make the different backends behave more similarly with respect to | |
140 signals and timeouts. The kqueue and solaris backends were the big | |
141 offenders previously, but they should be better now. Windows should | |
142 be better too, though it's likely that problems remain there. | |
143 | |
144 The libevent headers (though not the source files!) should now build | |
145 cleanly on C++. | |
146 | |
147 (For more bugfixes, see the ChangeLog file. These are only the | |
148 biggies.) | |
149 | |
150 4. Big performance improvements | |
151 | |
152 Libevent now uses a min-heap rather than a red-black tree to track | |
153 timeouts. This means that finding the next timeout to fire is now | |
154 O(1) instead of (lg n). | |
155 | |
156 The win32 select-based backend now uses a red-black tree to map | |
157 SOCKET handles to event structures. This changes the performance | |
158 characteristics of the event loop on win32 from O(n^2) to O(n lg n). | |
159 Not perfect, but better. | |
160 | |
161 5. Removed code and features | |
162 | |
163 The rtsig backend is now removed. It hasn't even compiled for a | |
164 while, and nobody seemed to miss it very much. All the platforms | |
165 that have rtsig seem to have a better option instead these days. | |
166 Please let us know if rtsig was crucial for you. | |
167 | |
OLD | NEW |