The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent
also supports callbacks due to signals or regular timeouts.
libevent
is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch()
and then add or remove events dynamically without having to change the event loop.
Currently, libevent
supports /dev/poll
, kqueue(2)
, event ports, POSIX select(2)
, Windows select()
, poll(2)
, and epoll(4)
. The internal event mechanism is completely independent of the exposed event API, and a simple update of libevent
can provide new functionality without having to redesign the applications. As a result, libevent
allows for portable application development and provides the most scalable event notification mechanism available on an operating system. libevent
can also be used for multi-threaded applications, either by isolating each event_base so that only a single thread accesses it, or by locked access to a single shared event_base
. libevent
should compile on Linux, *BSD, Mac OS X, Solaris, Windows, and more.
libevent
additionally provides a sophisticated framework for buffered network IO, with support for sockets, filters, rate-limiting, SSL, zero-copy file transmission, and IOCP. libevent
includes support for several useful protocols, including DNS, HTTP, and a minimal RPC framework.
More information about event notification mechanisms for network servers can be found on Dan Kegel's "The C10K problem" web page.
mkdir build && cd build
cmake .. # Default to Unix Makefiles.
make
make verify # (optional)
See Documentation/Building#Building on Unix using CMake for more information.
Install CMake: https://cmake.org/
md build && cd build
cmake -G "Visual Studio 10" .. # Or use any generator you want to use. Run cmake --help for a list
cmake --build . --config Release # Or "start libevent.sln" and build with menu in Visual Studio.
See Documentation/Building#Building on Windows for more information.
You can download and install libevent using the vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install libevent
The libevent port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
Note, since 2.2 it is deprecated
./configure
make
make verify # (optional)
sudo make install
See Documentation/Building#Autoconf for more information.
For the latest released version of Libevent, see the official website at https://libevent.org/ .
There's a pretty good work-in-progress manual up at http://www.wangafu.net/~nickm/libevent-book/ .
For the latest development versions of Libevent, access our Git repository via
$ git clone https://github.com/libevent/libevent.git
You can browse the git repository online at:
https://github.com/libevent/libevent
To report bugs, issues, or ask for new features:
Patches: https://github.com/libevent/libevent/pulls
OK, those are not really patches. You fork, modify, and hit the "Create Pull Request" button. You can still submit normal git patches via the mailing list.
Bugs, Features [RFC], and Issues: https://github.com/libevent/libevent/issues
Or you can do it via the mailing list.
There's also a libevent-users mailing list for talking about Libevent use and development:
https://archives.seul.org/libevent/users/
The following people have helped with suggestions, ideas, code or fixing bugs.