The Libevent Reference Manual: Preliminaries

內容

Libevent 2.0 has revised its APIs to be generally more rational and less error-prone. If it’s possible, you should write new programs to use the Libevent 2.0 APIs. But sometimes you might need to work with the older APIs, either to update an existing application, or to support an environment where for some reason you can’t install Libevent 2.0 or later.

Older versions of Libevent had fewer headers, and did not install them under "event2":

OLD HEADER…

…REPLACED BY CURRENT HEADERS

event.h

event2/event*.h, event2/buffer*.h event2/bufferevent*.h event2/tag*.h

evdns.h

event2/dns*.h

evhttp.h

event2/http*.h

evrpc.h

event2/rpc*.h

evutil.h

event2/util*.h

In Libevent 2.0 and later, the old headers still exist as wrappers for the new headers.

Some other notes on working with older versions:

  • Before 1.4, there was only one library, "libevent", that contained the functionality currently split into libevent_core and libevent_extra.
  • Before 2.0, there was no support for locking; Libevent could be thread-safe, but only if you made sure to never use the same structure from two threads at the same time.

Individual sections below will discuss the obsolete APIs that you might encounter for specific areas of the codebase.

Versions of Libevent before 1.4.7 or so should be considered totally obsolete. Versions of Libevent before 1.3e or so should be considered hopelessly bug-ridden.

(Also, please don’t send the Libevent maintainers any new features for 1.4.x or earlier---it’s supposed to stay as a stable release. And if you encounter a bug in 1.3x or earlier, please make sure that it still exists in the latest stable version before you report it: subsequent releases have happened for a reason.)

總結
Libevent 2.0 has updated its APIs to be more rational and less error-prone. New programs should use the 2.0 APIs, but older APIs may be needed for existing applications or certain environments. The old headers have been replaced by new headers in the event2 directory. Before 1.4, there was only one library, 'libevent', which is now split into libevent_core and libevent_extra. Before 2.0, there was no locking support. Versions before 1.4.7 are considered obsolete, and versions before 1.3e are considered bug-ridden. Avoid sending new features for 1.4.x or earlier to maintainers, as these are meant to be stable releases. When reporting bugs in 1.3x or earlier, ensure they still exist in the latest stable version.