libevent/libevent
FreeEvent notification library
FreeFree tier
About libevent/libevent
Libevent is a portable, high-performance event notification library for C. It provides a mechanism to execute a callback when a specific event occurs on a file descriptor, after a timeout, or when a signal is received. The library supports multiple I/O multiplexing backends including epoll, kqueue, devpoll, evport, and select, making it cross-platform on Unix-like systems and Windows. It includes buffered events for efficient I/O, an HTTP client and server implementation, a DNS resolver, RPC support, and integration with OpenSSL and mbedTLS for encrypted connections. The library also supports threading and is used in many critical applications such as memcached, tmux, and Tor. Published under a BSD license.
Key Features
Cross-platform event notification (epoll, kqueue, devpoll, evport, select)
Asynchronous I/O with bufferevents
HTTP client and server support
DNS resolution (evdns)
Remote procedure call (RPC) framework
OpenSSL and mbedTLS integration for TLS
Thread safety and threading support (pthreads, Win32 threads)
Signal and timer handling
Lightweight and high-performance design
Portable across Unix and Windows
Pros & Cons
Pros
- Portable across multiple operating systems
- Mature and widely used in production systems
- Efficient I/O multiplexing with automatic backend selection
- Comprehensive feature set (HTTP, DNS, RPC, SSL)
- BSD license allows use in proprietary software
Cons
- C API can be complex for beginners
- Documentation could be more extensive
- Windows support has some limitations compared to Unix
Best For
Building high-performance network servers (e.g., memcached, tmux, Tor)Real-time data streaming applicationsEvent-driven programming in CImplementing web servers or proxies with HTTP supportCreating asynchronous DNS resolversDeveloping encrypted communication services via OpenSSL
FAQ
What is libevent?
Libevent is a portable event notification library for C that allows you to execute callbacks when events occur on file descriptors, after a timeout, or on signal receipt.
How do I build libevent?
For Unix-based systems using CMake: create a build directory, run 'cmake ..' then 'make' and optionally 'make verify'. For Windows: use CMake with a generator like 'Visual Studio 10'.
What license does libevent use?
Libevent is distributed under a BSD-style license.
What I/O backends does libevent support?
Libevent supports epoll, kqueue, devpoll, evport, and select, automatically selecting the most efficient backend available.