libevent is a
software library
In computing, a library is a collection of resources that can be leveraged during software development to implement a computer program. Commonly, a library consists of executable code such as compiled functions and classes, or a library can ...
that provides asynchronous event notification. The libevent
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
provides a mechanism to execute a
callback function when a specific event occurs on a
file descriptor
In Unix and Unix-like computer operating systems, a file descriptor (FD, less frequently fildes) is a process-unique identifier (handle) for a file or other input/output resource, such as a pipe or network socket.
File descriptors typically h ...
or after a
timeout has been reached. libevent also supports callbacks triggered by
signals and regular timeouts.
libevent is meant to replace the
event loop found in event-driven
network servers. An application can just call
event_dispatch()
and then add or remove events dynamically without having to change the event loop.
Currently, libevent supports
/dev/poll
,
kqueue(2)
, POSIX
select(2)
, Windows
IOCP,
poll(2)
,
epoll(7)
and
Solaris event ports. It also has experimental support for real-time signals. The exposed event API is uniform over all of the supported platforms. As a result, libevent allows for
portable
Portable may refer to:
General
* Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work
* Portable classroom, a temporary building installed on the grounds of a school to provide a ...
application development and provides "the most
scalable event notification mechanism available on an operating system".
Using callbacks on signals, libevent makes it possible to write "secure" signal handlers as none of the user supplied signal handling code runs in the signal's
context.
libevent was created by
Niels Provos, and is maintained primarily by Azat Khuzhin. It is released under a
BSD license
BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft licenses, which have share-alike requirements. The original BSD lic ...
.
Notable applications
Some of the notable applications that take advantage of libevent are:
*
Google Chrome
Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, iPadOS, an ...
: Google's web browser (Mac and Linux versions)
*
Memcached: a high-performance, distributed memory object caching system
*
Transmission: an open-source BitTorrent client
*
ntpd: the Network Time Protocol
daemon
A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore.
Demon, daemon or dæmon may also refer to:
Entertainment Fictional entities
* Daemon (G.I. Joe), a character ...
*
Tor: an anonymous Internet communication system
*
tmux: a terminal multiplexer
Alternatives
libev*
libuv
*
FAM
Boost Asio
Major version releases
*libevent 2.1 was released on April 3, 2012.
*libevent 2.0 was released on April 17, 2009.
*libevent 1.4 was released on November 11, 2007.
*libevent 1.3 was released on February 15, 2007.
*libevent 1.2 was released on October 15, 2006.
*libevent 1.1 was released on May 14, 2005.
References
External links
{{Portal, Free and open-source software
Libevent web pageLibevent github repositoryLibevent 2.0 book
C (programming language) libraries
Events (computing)
Free computer libraries
Software using the BSD license