{{Short description|Software library}} {{Lowercase title}} {{Infobox software | name = libevent | logo = | screenshot = | caption = | collapsible = | author = | developer = Azat Khuzhin, Mark Ellzey, Nick Mathewson, Niels Provos | released = {{release date and age|2002|04|09}} | latest release version = 2.1.12 | latest release date = {{release date and age|2020|07|05}}<ref name="libevent_org">{{cite web |title=libevent – an event notification library |url=https://libevent.org/ |website=libevent.org |accessdate=17 September 2021}}</ref> | status = | programming language = C | operating system = Cross-platform | platform = Unix-like, Windows, OS X | size = | language = | genre = Network Library | license = BSD<ref>{{cite web |title=LICENSE |url=https://github.com/libevent/libevent/blob/master/LICENSE |website=Github |accessdate=30 August 2019}}</ref> | website = {{URL|http://libevent.org/}} | frequently updated = }}
'''libevent''' is a software library that provides asynchronous event notification. 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. 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 <code>event_dispatch()</code> and then add or remove events dynamically without having to change the event loop.
Currently, libevent supports <code>/dev/poll</code>, <code>kqueue(2)</code>, POSIX <code>select(2)</code>, Windows IOCP, <code>poll(2)</code>, <code>epoll(7)</code> 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 application development and provides "the most scalable event notification mechanism available on an operating system".<ref name="libevent_org"></ref>
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.<ref>http://www.monkey.org/~provos/libevent/LICENSE License of libevent</ref>
== Notable applications == {{Unreferenced section|date=June 2013}} Some of the notable applications that take advantage of libevent are:<ref name="LibeventPrograms2">{{cite web |title=An Event Notification Library, Programs using libevent |url=https://libevent.org/ |access-date=2026-01-01 |website=libevent.org}}</ref>
* Chromium: Google's open-source web browser * memcached: a high-performance, distributed memory object caching system * Transmission: a fast, easy, and free BitTorrent client * NTP: the network time protocol that makes your clock right (uses libevent in SNTP) * tmux: a terminal multiplexer * Tor: an anonymous Internet communication system
== Alternatives == * [http://software.schmorp.de/pkg/libev.html libev] * libuv * FAM * [https://www.boost.org/doc/libs/1_81_0/doc/html/boost_asio.html Boost Asio]
==Major version releases== *libevent 2.1 was released on April 3, 2012.<ref name="release-dates">{{Cite web |title=Old releases |url=https://libevent.org/old-releases.html |url-status=live |access-date=2025-11-13 |website=libevent.org}}</ref> *libevent 2.0 was released on April 17, 2009.<ref name="release-dates" /> *libevent 1.4 was released on November 11, 2007.<ref name="release-dates" /> *libevent 1.3 was released on February 15, 2007.<ref name="release-dates" /> *libevent 1.2 was released on October 15, 2006.<ref name="release-dates" /> *libevent 1.1 was released on May 14, 2005.<ref name="release-dates" />
==References== {{Reflist}}
==External links== {{Portal|Free and open-source software}} * [http://libevent.org/ Libevent web page] * [https://github.com/libevent/libevent Libevent github repository] * [http://www.wangafu.net/~nickm/libevent-book/ Libevent 2.0 book] * [https://web.archive.org/web/20130722134723/http://www.kegel.com/c10k.html Dan Kegel's "The C10K problem" web page] * [http://libev.schmorp.de/bench.html A benchmark by the libev author comparing libevent with libev, a similar library]
Category:C (programming language) libraries Category:Events (computing) Category:Free computer libraries Category:Software using the BSD license