Libevent
Encyclopedia
libevent is an asynchronous event notification software library.
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
Currently, libevent supports
,
,
,
and Solaris
's event ports. It also has experimental support for real-time signals. 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.
Using callbacks on signals, libevent makes it easy 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
. It is released under a BSD license.
The libevent API provides a mechanism to execute a callback
Callback (computer science)
In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine defined in a higher-level layer....
function when a specific event occurs on a file descriptor
File descriptor
In computer programming, a file descriptor is an abstract indicator for accessing a file. The term is generally used in POSIX operating systems...
or after a timeout
Timeout (telecommunication)
In telecommunication and related engineering , the term timeout or time-out has several meanings, including...
has been reached. Furthermore, libevent also supports callbacks due to signals
Signal (computing)
A signal is a limited form of inter-process communication used in Unix, Unix-like, and other POSIX-compliant operating systems. Essentially it is an asynchronous notification sent to a process in order to notify it of an event that occurred. When a signal is sent to a process, the operating system...
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)
Kqueue
Kqueue is a scalable event notification interface introduced in FreeBSD 4.1, also supported in NetBSD, OpenBSD, DragonflyBSD, and Mac OS X. It's the foundation of Apple's Grand Central Dispatch....
,
select(2)
Select (Unix)
select is a system call and application programming interface in Unix-like and POSIX-compliant operating systems for examining the status of file descriptors of open input/output channels...
,
poll(2)
Select (Unix)
select is a system call and application programming interface in Unix-like and POSIX-compliant operating systems for examining the status of file descriptors of open input/output channels...
,
epoll(4)
Epoll
epoll is a scalable I/O event notification mechanism for Linux, first introduced in Linux 2.5.44 . It is meant to replace the older POSIX select and poll system calls, to achieve better performance in more demanding applications, where the number of watched file descriptors is large...
and Solaris
Solaris Operating System
Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010....
's event ports. It also has experimental support for real-time signals. 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.
Using callbacks on signals, libevent makes it easy 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
Niels Provos
Niels Provos is a researcher in the areas of secure systems, malware and cryptography. He is currently a Principal Software Engineer at Google. He received his PhD in Computer Science from the University of Michigan....
. It is released under a BSD license.
Major version releases
- libevent 2.0 was released on November 19, 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.