
libevent
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 support callbacks due to signals or regular timeouts. libevent is meant to replace the event loop
libevent: Main Page
2017年1月8日 · Libevent is an event notification library for developing scalable network servers. 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 support callbacks due to signals or regular timeouts.
Fast portable non-blocking network programming with Libevent
R1: Setting up the Libevent library. R2: Getting an event_base. R3: Running an event loop. R4: Working with events. R5: Utility and portability functions. R6: Bufferevents: concepts and basics. R6a: Bufferevents: advanced topics. R7: Evbuffers: utility functionality for buffered IO. R8: Connection listeners: accepting TCP connections. R9: DNS ...
Working with events
Libevent lets you solve this by placing some of your timeouts in queues, and others in the binary heap. To do this, you ask Libevent for a special "common timeout" timeval, which you then use to add events having that timeval.
The Libevent Reference Manual: Preliminaries
Libevent is designed to work well even with programs that need to have tens of thousands of active sockets. Convenience Whenever possible, the most natural way to write a program with Libevent should be the stable, portable way.
Bufferevents: concepts and basics
A socket-based bufferevent uses Libevent’s underlying event mechanism to detect when an underlying network socket is ready for read and/or write operations, and uses underlying network calls (like readv, writev, WSASend, or WSARecv) to transmit and receive data.
libevent: event2/event.h File Reference
2017年1月8日 · By default Libevent schedules all active events with the same priority. However, some time it is desirable to process some events with a higher priority than others. For that reason, Libevent supports strict priority queues. Active events with a lower priority are always processed before events with a higher priority.
Using the built-in HTTP server - libevent
2024年2月18日 · The plain network-based Libevent interface is useful if you want to build native applications, but it is increasingly common to develop an application based around the HTTP protocol and a web page that loads, or more commonly dynamically reloads, information.
Setting up the Libevent library
By default, Libevent uses the C library’s memory management functions to allocate memory from the heap. You can have Libevent use another memory manager by providing your own replacements for malloc, realloc, and free.
Helper functions and types for Libevent
The <event2/util.h> header defines many functions that you might find helpful for implementing portable applications using Libevent. Libevent uses these types and functions internally.