Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/event2
File: event.h
/*
[0] Fix | Delete
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
[1] Fix | Delete
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
[2] Fix | Delete
*
[3] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[4] Fix | Delete
* modification, are permitted provided that the following conditions
[5] Fix | Delete
* are met:
[6] Fix | Delete
* 1. Redistributions of source code must retain the above copyright
[7] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[8] Fix | Delete
* 2. Redistributions in binary form must reproduce the above copyright
[9] Fix | Delete
* notice, this list of conditions and the following disclaimer in the
[10] Fix | Delete
* documentation and/or other materials provided with the distribution.
[11] Fix | Delete
* 3. The name of the author may not be used to endorse or promote products
[12] Fix | Delete
* derived from this software without specific prior written permission.
[13] Fix | Delete
*
[14] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
[15] Fix | Delete
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
[16] Fix | Delete
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
[17] Fix | Delete
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
[18] Fix | Delete
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
[19] Fix | Delete
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
[20] Fix | Delete
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
[21] Fix | Delete
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
[22] Fix | Delete
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
[23] Fix | Delete
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[24] Fix | Delete
*/
[25] Fix | Delete
#ifndef EVENT2_EVENT_H_INCLUDED_
[26] Fix | Delete
#define EVENT2_EVENT_H_INCLUDED_
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
@mainpage
[30] Fix | Delete
[31] Fix | Delete
@section intro Introduction
[32] Fix | Delete
[33] Fix | Delete
Libevent is an event notification library for developing scalable network
[34] Fix | Delete
servers. The Libevent API provides a mechanism to execute a callback
[35] Fix | Delete
function when a specific event occurs on a file descriptor or after a
[36] Fix | Delete
timeout has been reached. Furthermore, Libevent also support callbacks due
[37] Fix | Delete
to signals or regular timeouts.
[38] Fix | Delete
[39] Fix | Delete
Libevent is meant to replace the event loop found in event driven network
[40] Fix | Delete
servers. An application just needs to call event_base_dispatch() and then add or
[41] Fix | Delete
remove events dynamically without having to change the event loop.
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
Currently, Libevent supports /dev/poll, kqueue(2), select(2), poll(2),
[45] Fix | Delete
epoll(4), and evports. The internal event mechanism is completely
[46] Fix | Delete
independent of the exposed event API, and a simple update of Libevent can
[47] Fix | Delete
provide new functionality without having to redesign the applications. As a
[48] Fix | Delete
result, Libevent allows for portable application development and provides
[49] Fix | Delete
the most scalable event notification mechanism available on an operating
[50] Fix | Delete
system. Libevent can also be used for multithreaded programs. Libevent
[51] Fix | Delete
should compile on Linux, *BSD, Mac OS X, Solaris and, Windows.
[52] Fix | Delete
[53] Fix | Delete
@section usage Standard usage
[54] Fix | Delete
[55] Fix | Delete
Every program that uses Libevent must include the <event2/event.h>
[56] Fix | Delete
header, and pass the -levent flag to the linker. (You can instead link
[57] Fix | Delete
-levent_core if you only want the main event and buffered IO-based code,
[58] Fix | Delete
and don't want to link any protocol code.)
[59] Fix | Delete
[60] Fix | Delete
@section setup Library setup
[61] Fix | Delete
[62] Fix | Delete
Before you call any other Libevent functions, you need to set up the
[63] Fix | Delete
library. If you're going to use Libevent from multiple threads in a
[64] Fix | Delete
multithreaded application, you need to initialize thread support --
[65] Fix | Delete
typically by using evthread_use_pthreads() or
[66] Fix | Delete
evthread_use_windows_threads(). See <event2/thread.h> for more
[67] Fix | Delete
information.
[68] Fix | Delete
[69] Fix | Delete
This is also the point where you can replace Libevent's memory
[70] Fix | Delete
management functions with event_set_mem_functions, and enable debug mode
[71] Fix | Delete
with event_enable_debug_mode().
[72] Fix | Delete
[73] Fix | Delete
@section base Creating an event base
[74] Fix | Delete
[75] Fix | Delete
Next, you need to create an event_base structure, using event_base_new()
[76] Fix | Delete
or event_base_new_with_config(). The event_base is responsible for
[77] Fix | Delete
keeping track of which events are "pending" (that is to say, being
[78] Fix | Delete
watched to see if they become active) and which events are "active".
[79] Fix | Delete
Every event is associated with a single event_base.
[80] Fix | Delete
[81] Fix | Delete
@section event Event notification
[82] Fix | Delete
[83] Fix | Delete
For each file descriptor that you wish to monitor, you must create an
[84] Fix | Delete
event structure with event_new(). (You may also declare an event
[85] Fix | Delete
structure and call event_assign() to initialize the members of the
[86] Fix | Delete
structure.) To enable notification, you add the structure to the list
[87] Fix | Delete
of monitored events by calling event_add(). The event structure must
[88] Fix | Delete
remain allocated as long as it is active, so it should generally be
[89] Fix | Delete
allocated on the heap.
[90] Fix | Delete
[91] Fix | Delete
@section loop Dispatching events.
[92] Fix | Delete
[93] Fix | Delete
Finally, you call event_base_dispatch() to loop and dispatch events.
[94] Fix | Delete
You can also use event_base_loop() for more fine-grained control.
[95] Fix | Delete
[96] Fix | Delete
Currently, only one thread can be dispatching a given event_base at a
[97] Fix | Delete
time. If you want to run events in multiple threads at once, you can
[98] Fix | Delete
either have a single event_base whose events add work to a work queue,
[99] Fix | Delete
or you can create multiple event_base objects.
[100] Fix | Delete
[101] Fix | Delete
@section bufferevent I/O Buffers
[102] Fix | Delete
[103] Fix | Delete
Libevent provides a buffered I/O abstraction on top of the regular event
[104] Fix | Delete
callbacks. This abstraction is called a bufferevent. A bufferevent
[105] Fix | Delete
provides input and output buffers that get filled and drained
[106] Fix | Delete
automatically. The user of a buffered event no longer deals directly
[107] Fix | Delete
with the I/O, but instead is reading from input and writing to output
[108] Fix | Delete
buffers.
[109] Fix | Delete
[110] Fix | Delete
Once initialized via bufferevent_socket_new(), the bufferevent structure
[111] Fix | Delete
can be used repeatedly with bufferevent_enable() and
[112] Fix | Delete
bufferevent_disable(). Instead of reading and writing directly to a
[113] Fix | Delete
socket, you would call bufferevent_read() and bufferevent_write().
[114] Fix | Delete
[115] Fix | Delete
When read enabled the bufferevent will try to read from the file descriptor
[116] Fix | Delete
and call the read callback. The write callback is executed whenever the
[117] Fix | Delete
output buffer is drained below the write low watermark, which is 0 by
[118] Fix | Delete
default.
[119] Fix | Delete
[120] Fix | Delete
See <event2/bufferevent*.h> for more information.
[121] Fix | Delete
[122] Fix | Delete
@section timers Timers
[123] Fix | Delete
[124] Fix | Delete
Libevent can also be used to create timers that invoke a callback after a
[125] Fix | Delete
certain amount of time has expired. The evtimer_new() macro returns
[126] Fix | Delete
an event struct to use as a timer. To activate the timer, call
[127] Fix | Delete
evtimer_add(). Timers can be deactivated by calling evtimer_del().
[128] Fix | Delete
(These macros are thin wrappers around event_new(), event_add(),
[129] Fix | Delete
and event_del(); you can also use those instead.)
[130] Fix | Delete
[131] Fix | Delete
@section evdns Asynchronous DNS resolution
[132] Fix | Delete
[133] Fix | Delete
Libevent provides an asynchronous DNS resolver that should be used instead
[134] Fix | Delete
of the standard DNS resolver functions. See the <event2/dns.h>
[135] Fix | Delete
functions for more detail.
[136] Fix | Delete
[137] Fix | Delete
@section evhttp Event-driven HTTP servers
[138] Fix | Delete
[139] Fix | Delete
Libevent provides a very simple event-driven HTTP server that can be
[140] Fix | Delete
embedded in your program and used to service HTTP requests.
[141] Fix | Delete
[142] Fix | Delete
To use this capability, you need to include the <event2/http.h> header in your
[143] Fix | Delete
program. See that header for more information.
[144] Fix | Delete
[145] Fix | Delete
@section evrpc A framework for RPC servers and clients
[146] Fix | Delete
[147] Fix | Delete
Libevent provides a framework for creating RPC servers and clients. It
[148] Fix | Delete
takes care of marshaling and unmarshaling all data structures.
[149] Fix | Delete
[150] Fix | Delete
@section api API Reference
[151] Fix | Delete
[152] Fix | Delete
To browse the complete documentation of the libevent API, click on any of
[153] Fix | Delete
the following links.
[154] Fix | Delete
[155] Fix | Delete
event2/event.h
[156] Fix | Delete
The primary libevent header
[157] Fix | Delete
[158] Fix | Delete
event2/thread.h
[159] Fix | Delete
Functions for use by multithreaded programs
[160] Fix | Delete
[161] Fix | Delete
event2/buffer.h and event2/bufferevent.h
[162] Fix | Delete
Buffer management for network reading and writing
[163] Fix | Delete
[164] Fix | Delete
event2/util.h
[165] Fix | Delete
Utility functions for portable nonblocking network code
[166] Fix | Delete
[167] Fix | Delete
event2/dns.h
[168] Fix | Delete
Asynchronous DNS resolution
[169] Fix | Delete
[170] Fix | Delete
event2/http.h
[171] Fix | Delete
An embedded libevent-based HTTP server
[172] Fix | Delete
[173] Fix | Delete
event2/rpc.h
[174] Fix | Delete
A framework for creating RPC servers and clients
[175] Fix | Delete
[176] Fix | Delete
*/
[177] Fix | Delete
[178] Fix | Delete
/** @file event2/event.h
[179] Fix | Delete
[180] Fix | Delete
Core functions for waiting for and receiving events, and using event bases.
[181] Fix | Delete
*/
[182] Fix | Delete
[183] Fix | Delete
#include <event2/visibility.h>
[184] Fix | Delete
[185] Fix | Delete
#ifdef __cplusplus
[186] Fix | Delete
extern "C" {
[187] Fix | Delete
#endif
[188] Fix | Delete
[189] Fix | Delete
#include <event2/event-config.h>
[190] Fix | Delete
#ifdef EVENT__HAVE_SYS_TYPES_H
[191] Fix | Delete
#include <sys/types.h>
[192] Fix | Delete
#endif
[193] Fix | Delete
#ifdef EVENT__HAVE_SYS_TIME_H
[194] Fix | Delete
#include <sys/time.h>
[195] Fix | Delete
#endif
[196] Fix | Delete
[197] Fix | Delete
#include <stdio.h>
[198] Fix | Delete
[199] Fix | Delete
/* For int types. */
[200] Fix | Delete
#include <event2/util.h>
[201] Fix | Delete
[202] Fix | Delete
/**
[203] Fix | Delete
* Structure to hold information and state for a Libevent dispatch loop.
[204] Fix | Delete
*
[205] Fix | Delete
* The event_base lies at the center of Libevent; every application will
[206] Fix | Delete
* have one. It keeps track of all pending and active events, and
[207] Fix | Delete
* notifies your application of the active ones.
[208] Fix | Delete
*
[209] Fix | Delete
* This is an opaque structure; you can allocate one using
[210] Fix | Delete
* event_base_new() or event_base_new_with_config().
[211] Fix | Delete
*
[212] Fix | Delete
* @see event_base_new(), event_base_free(), event_base_loop(),
[213] Fix | Delete
* event_base_new_with_config()
[214] Fix | Delete
*/
[215] Fix | Delete
struct event_base
[216] Fix | Delete
#ifdef EVENT_IN_DOXYGEN_
[217] Fix | Delete
{/*Empty body so that doxygen will generate documentation here.*/}
[218] Fix | Delete
#endif
[219] Fix | Delete
;
[220] Fix | Delete
[221] Fix | Delete
/**
[222] Fix | Delete
* @struct event
[223] Fix | Delete
*
[224] Fix | Delete
* Structure to represent a single event.
[225] Fix | Delete
*
[226] Fix | Delete
* An event can have some underlying condition it represents: a socket
[227] Fix | Delete
* becoming readable or writeable (or both), or a signal becoming raised.
[228] Fix | Delete
* (An event that represents no underlying condition is still useful: you
[229] Fix | Delete
* can use one to implement a timer, or to communicate between threads.)
[230] Fix | Delete
*
[231] Fix | Delete
* Generally, you can create events with event_new(), then make them
[232] Fix | Delete
* pending with event_add(). As your event_base runs, it will run the
[233] Fix | Delete
* callbacks of an events whose conditions are triggered. When you
[234] Fix | Delete
* longer want the event, free it with event_free().
[235] Fix | Delete
*
[236] Fix | Delete
* In more depth:
[237] Fix | Delete
*
[238] Fix | Delete
* An event may be "pending" (one whose condition we are watching),
[239] Fix | Delete
* "active" (one whose condition has triggered and whose callback is about
[240] Fix | Delete
* to run), neither, or both. Events come into existence via
[241] Fix | Delete
* event_assign() or event_new(), and are then neither active nor pending.
[242] Fix | Delete
*
[243] Fix | Delete
* To make an event pending, pass it to event_add(). When doing so, you
[244] Fix | Delete
* can also set a timeout for the event.
[245] Fix | Delete
*
[246] Fix | Delete
* Events become active during an event_base_loop() call when either their
[247] Fix | Delete
* condition has triggered, or when their timeout has elapsed. You can
[248] Fix | Delete
* also activate an event manually using event_active(). The even_base
[249] Fix | Delete
* loop will run the callbacks of active events; after it has done so, it
[250] Fix | Delete
* marks them as no longer active.
[251] Fix | Delete
*
[252] Fix | Delete
* You can make an event non-pending by passing it to event_del(). This
[253] Fix | Delete
* also makes the event non-active.
[254] Fix | Delete
*
[255] Fix | Delete
* Events can be "persistent" or "non-persistent". A non-persistent event
[256] Fix | Delete
* becomes non-pending as soon as it is triggered: thus, it only runs at
[257] Fix | Delete
* most once per call to event_add(). A persistent event remains pending
[258] Fix | Delete
* even when it becomes active: you'll need to event_del() it manually in
[259] Fix | Delete
* order to make it non-pending. When a persistent event with a timeout
[260] Fix | Delete
* becomes active, its timeout is reset: this means you can use persistent
[261] Fix | Delete
* events to implement periodic timeouts.
[262] Fix | Delete
*
[263] Fix | Delete
* This should be treated as an opaque structure; you should never read or
[264] Fix | Delete
* write any of its fields directly. For backward compatibility with old
[265] Fix | Delete
* code, it is defined in the event2/event_struct.h header; including this
[266] Fix | Delete
* header may make your code incompatible with other versions of Libevent.
[267] Fix | Delete
*
[268] Fix | Delete
* @see event_new(), event_free(), event_assign(), event_get_assignment(),
[269] Fix | Delete
* event_add(), event_del(), event_active(), event_pending(),
[270] Fix | Delete
* event_get_fd(), event_get_base(), event_get_events(),
[271] Fix | Delete
* event_get_callback(), event_get_callback_arg(),
[272] Fix | Delete
* event_priority_set()
[273] Fix | Delete
*/
[274] Fix | Delete
struct event
[275] Fix | Delete
#ifdef EVENT_IN_DOXYGEN_
[276] Fix | Delete
{/*Empty body so that doxygen will generate documentation here.*/}
[277] Fix | Delete
#endif
[278] Fix | Delete
;
[279] Fix | Delete
[280] Fix | Delete
/**
[281] Fix | Delete
* Configuration for an event_base.
[282] Fix | Delete
*
[283] Fix | Delete
* There are many options that can be used to alter the behavior and
[284] Fix | Delete
* implementation of an event_base. To avoid having to pass them all in a
[285] Fix | Delete
* complex many-argument constructor, we provide an abstract data type
[286] Fix | Delete
* wrhere you set up configation information before passing it to
[287] Fix | Delete
* event_base_new_with_config().
[288] Fix | Delete
*
[289] Fix | Delete
* @see event_config_new(), event_config_free(), event_base_new_with_config(),
[290] Fix | Delete
* event_config_avoid_method(), event_config_require_features(),
[291] Fix | Delete
* event_config_set_flag(), event_config_set_num_cpus_hint()
[292] Fix | Delete
*/
[293] Fix | Delete
struct event_config
[294] Fix | Delete
#ifdef EVENT_IN_DOXYGEN_
[295] Fix | Delete
{/*Empty body so that doxygen will generate documentation here.*/}
[296] Fix | Delete
#endif
[297] Fix | Delete
;
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* Enable some relatively expensive debugging checks in Libevent that
[301] Fix | Delete
* would normally be turned off. Generally, these checks cause code that
[302] Fix | Delete
* would otherwise crash mysteriously to fail earlier with an assertion
[303] Fix | Delete
* failure. Note that this method MUST be called before any events or
[304] Fix | Delete
* event_bases have been created.
[305] Fix | Delete
*
[306] Fix | Delete
* Debug mode can currently catch the following errors:
[307] Fix | Delete
* An event is re-assigned while it is added
[308] Fix | Delete
* Any function is called on a non-assigned event
[309] Fix | Delete
*
[310] Fix | Delete
* Note that debugging mode uses memory to track every event that has been
[311] Fix | Delete
* initialized (via event_assign, event_set, or event_new) but not yet
[312] Fix | Delete
* released (via event_free or event_debug_unassign). If you want to use
[313] Fix | Delete
* debug mode, and you find yourself running out of memory, you will need
[314] Fix | Delete
* to use event_debug_unassign to explicitly stop tracking events that
[315] Fix | Delete
* are no longer considered set-up.
[316] Fix | Delete
*
[317] Fix | Delete
* @see event_debug_unassign()
[318] Fix | Delete
*/
[319] Fix | Delete
EVENT2_EXPORT_SYMBOL
[320] Fix | Delete
void event_enable_debug_mode(void);
[321] Fix | Delete
[322] Fix | Delete
/**
[323] Fix | Delete
* When debugging mode is enabled, informs Libevent that an event should no
[324] Fix | Delete
* longer be considered as assigned. When debugging mode is not enabled, does
[325] Fix | Delete
* nothing.
[326] Fix | Delete
*
[327] Fix | Delete
* This function must only be called on a non-added event.
[328] Fix | Delete
*
[329] Fix | Delete
* @see event_enable_debug_mode()
[330] Fix | Delete
*/
[331] Fix | Delete
EVENT2_EXPORT_SYMBOL
[332] Fix | Delete
void event_debug_unassign(struct event *);
[333] Fix | Delete
[334] Fix | Delete
/**
[335] Fix | Delete
* Create and return a new event_base to use with the rest of Libevent.
[336] Fix | Delete
*
[337] Fix | Delete
* @return a new event_base on success, or NULL on failure.
[338] Fix | Delete
*
[339] Fix | Delete
* @see event_base_free(), event_base_new_with_config()
[340] Fix | Delete
*/
[341] Fix | Delete
EVENT2_EXPORT_SYMBOL
[342] Fix | Delete
struct event_base *event_base_new(void);
[343] Fix | Delete
[344] Fix | Delete
/**
[345] Fix | Delete
Reinitialize the event base after a fork
[346] Fix | Delete
[347] Fix | Delete
Some event mechanisms do not survive across fork. The event base needs
[348] Fix | Delete
to be reinitialized with the event_reinit() function.
[349] Fix | Delete
[350] Fix | Delete
@param base the event base that needs to be re-initialized
[351] Fix | Delete
@return 0 if successful, or -1 if some events could not be re-added.
[352] Fix | Delete
@see event_base_new()
[353] Fix | Delete
*/
[354] Fix | Delete
EVENT2_EXPORT_SYMBOL
[355] Fix | Delete
int event_reinit(struct event_base *base);
[356] Fix | Delete
[357] Fix | Delete
/**
[358] Fix | Delete
Event dispatching loop
[359] Fix | Delete
[360] Fix | Delete
This loop will run the event base until either there are no more pending or
[361] Fix | Delete
active, or until something calls event_base_loopbreak() or
[362] Fix | Delete
event_base_loopexit().
[363] Fix | Delete
[364] Fix | Delete
@param base the event_base structure returned by event_base_new() or
[365] Fix | Delete
event_base_new_with_config()
[366] Fix | Delete
@return 0 if successful, -1 if an error occurred, or 1 if we exited because
[367] Fix | Delete
no events were pending or active.
[368] Fix | Delete
@see event_base_loop()
[369] Fix | Delete
*/
[370] Fix | Delete
EVENT2_EXPORT_SYMBOL
[371] Fix | Delete
int event_base_dispatch(struct event_base *);
[372] Fix | Delete
[373] Fix | Delete
/**
[374] Fix | Delete
Get the kernel event notification mechanism used by Libevent.
[375] Fix | Delete
[376] Fix | Delete
@param eb the event_base structure returned by event_base_new()
[377] Fix | Delete
@return a string identifying the kernel event mechanism (kqueue, epoll, etc.)
[378] Fix | Delete
*/
[379] Fix | Delete
EVENT2_EXPORT_SYMBOL
[380] Fix | Delete
const char *event_base_get_method(const struct event_base *);
[381] Fix | Delete
[382] Fix | Delete
/**
[383] Fix | Delete
Gets all event notification mechanisms supported by Libevent.
[384] Fix | Delete
[385] Fix | Delete
This functions returns the event mechanism in order preferred by
[386] Fix | Delete
Libevent. Note that this list will include all backends that
[387] Fix | Delete
Libevent has compiled-in support for, and will not necessarily check
[388] Fix | Delete
your OS to see whether it has the required resources.
[389] Fix | Delete
[390] Fix | Delete
@return an array with pointers to the names of support methods.
[391] Fix | Delete
The end of the array is indicated by a NULL pointer. If an
[392] Fix | Delete
error is encountered NULL is returned.
[393] Fix | Delete
*/
[394] Fix | Delete
EVENT2_EXPORT_SYMBOL
[395] Fix | Delete
const char **event_get_supported_methods(void);
[396] Fix | Delete
[397] Fix | Delete
/** Query the current monotonic time from a the timer for a struct
[398] Fix | Delete
* event_base.
[399] Fix | Delete
*/
[400] Fix | Delete
EVENT2_EXPORT_SYMBOL
[401] Fix | Delete
int event_gettime_monotonic(struct event_base *base, struct timeval *tp);
[402] Fix | Delete
[403] Fix | Delete
/**
[404] Fix | Delete
@name event type flag
[405] Fix | Delete
[406] Fix | Delete
Flags to pass to event_base_get_num_events() to specify the kinds of events
[407] Fix | Delete
we want to aggregate counts for
[408] Fix | Delete
*/
[409] Fix | Delete
/**@{*/
[410] Fix | Delete
/** count the number of active events, which have been triggered.*/
[411] Fix | Delete
#define EVENT_BASE_COUNT_ACTIVE 1U
[412] Fix | Delete
/** count the number of virtual events, which is used to represent an internal
[413] Fix | Delete
* condition, other than a pending event, that keeps the loop from exiting. */
[414] Fix | Delete
#define EVENT_BASE_COUNT_VIRTUAL 2U
[415] Fix | Delete
/** count the number of events which have been added to event base, including
[416] Fix | Delete
* internal events. */
[417] Fix | Delete
#define EVENT_BASE_COUNT_ADDED 4U
[418] Fix | Delete
/**@}*/
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
Gets the number of events in event_base, as specified in the flags.
[422] Fix | Delete
[423] Fix | Delete
Since event base has some internal events added to make some of its
[424] Fix | Delete
functionalities work, EVENT_BASE_COUNT_ADDED may return more than the
[425] Fix | Delete
number of events you added using event_add().
[426] Fix | Delete
[427] Fix | Delete
If you pass EVENT_BASE_COUNT_ACTIVE and EVENT_BASE_COUNT_ADDED together, an
[428] Fix | Delete
active event will be counted twice. However, this might not be the case in
[429] Fix | Delete
future libevent versions. The return value is an indication of the work
[430] Fix | Delete
load, but the user shouldn't rely on the exact value as this may change in
[431] Fix | Delete
the future.
[432] Fix | Delete
[433] Fix | Delete
@param eb the event_base structure returned by event_base_new()
[434] Fix | Delete
@param flags a bitwise combination of the kinds of events to aggregate
[435] Fix | Delete
counts for
[436] Fix | Delete
@return the number of events specified in the flags
[437] Fix | Delete
*/
[438] Fix | Delete
EVENT2_EXPORT_SYMBOL
[439] Fix | Delete
int event_base_get_num_events(struct event_base *, unsigned int);
[440] Fix | Delete
[441] Fix | Delete
/**
[442] Fix | Delete
Get the maximum number of events in a given event_base as specified in the
[443] Fix | Delete
flags.
[444] Fix | Delete
[445] Fix | Delete
@param eb the event_base structure returned by event_base_new()
[446] Fix | Delete
@param flags a bitwise combination of the kinds of events to aggregate
[447] Fix | Delete
counts for
[448] Fix | Delete
@param clear option used to reset the maximum count.
[449] Fix | Delete
@return the number of events specified in the flags
[450] Fix | Delete
*/
[451] Fix | Delete
EVENT2_EXPORT_SYMBOL
[452] Fix | Delete
int event_base_get_max_events(struct event_base *, unsigned int, int);
[453] Fix | Delete
[454] Fix | Delete
/**
[455] Fix | Delete
Allocates a new event configuration object.
[456] Fix | Delete
[457] Fix | Delete
The event configuration object can be used to change the behavior of
[458] Fix | Delete
an event base.
[459] Fix | Delete
[460] Fix | Delete
@return an event_config object that can be used to store configuration, or
[461] Fix | Delete
NULL if an error is encountered.
[462] Fix | Delete
@see event_base_new_with_config(), event_config_free(), event_config
[463] Fix | Delete
*/
[464] Fix | Delete
EVENT2_EXPORT_SYMBOL
[465] Fix | Delete
struct event_config *event_config_new(void);
[466] Fix | Delete
[467] Fix | Delete
/**
[468] Fix | Delete
Deallocates all memory associated with an event configuration object
[469] Fix | Delete
[470] Fix | Delete
@param cfg the event configuration object to be freed.
[471] Fix | Delete
*/
[472] Fix | Delete
EVENT2_EXPORT_SYMBOL
[473] Fix | Delete
void event_config_free(struct event_config *cfg);
[474] Fix | Delete
[475] Fix | Delete
/**
[476] Fix | Delete
Enters an event method that should be avoided into the configuration.
[477] Fix | Delete
[478] Fix | Delete
This can be used to avoid event mechanisms that do not support certain
[479] Fix | Delete
file descriptor types, or for debugging to avoid certain event
[480] Fix | Delete
mechanisms. An application can make use of multiple event bases to
[481] Fix | Delete
accommodate incompatible file descriptor types.
[482] Fix | Delete
[483] Fix | Delete
@param cfg the event configuration object
[484] Fix | Delete
@param method the name of the event method to avoid
[485] Fix | Delete
@return 0 on success, -1 on failure.
[486] Fix | Delete
*/
[487] Fix | Delete
EVENT2_EXPORT_SYMBOL
[488] Fix | Delete
int event_config_avoid_method(struct event_config *cfg, const char *method);
[489] Fix | Delete
[490] Fix | Delete
/**
[491] Fix | Delete
A flag used to describe which features an event_base (must) provide.
[492] Fix | Delete
[493] Fix | Delete
Because of OS limitations, not every Libevent backend supports every
[494] Fix | Delete
possible feature. You can use this type with
[495] Fix | Delete
event_config_require_features() to tell Libevent to only proceed if your
[496] Fix | Delete
event_base implements a given feature, and you can receive this type from
[497] Fix | Delete
event_base_get_features() to see which features are available.
[498] Fix | Delete
*/
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function