libevent-2.1.12-stable
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
event.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef EVENT2_EVENT_H_INCLUDED_
28 #define EVENT2_EVENT_H_INCLUDED_
29 
185 #include <event2/visibility.h>
186 
187 #ifdef __cplusplus
188 extern "C" {
189 #endif
190 
191 #include <event2/event-config.h>
192 #ifdef EVENT__HAVE_SYS_TYPES_H
193 #include <sys/types.h>
194 #endif
195 #ifdef EVENT__HAVE_SYS_TIME_H
196 #include <sys/time.h>
197 #endif
198 
199 #include <stdio.h>
200 
201 /* For int types. */
202 #include <event2/util.h>
203 
218 #ifdef EVENT_IN_DOXYGEN_
219 {/*Empty body so that doxygen will generate documentation here.*/}
220 #endif
221 ;
222 
276 struct event
277 #ifdef EVENT_IN_DOXYGEN_
278 {/*Empty body so that doxygen will generate documentation here.*/}
279 #endif
280 ;
281 
296 #ifdef EVENT_IN_DOXYGEN_
297 {/*Empty body so that doxygen will generate documentation here.*/}
298 #endif
299 ;
300 
321 EVENT2_EXPORT_SYMBOL
322 void event_enable_debug_mode(void);
323 
333 EVENT2_EXPORT_SYMBOL
334 void event_debug_unassign(struct event *);
335 
343 EVENT2_EXPORT_SYMBOL
344 struct event_base *event_base_new(void);
345 
356 EVENT2_EXPORT_SYMBOL
357 int event_reinit(struct event_base *base);
358 
372 EVENT2_EXPORT_SYMBOL
373 int event_base_dispatch(struct event_base *);
374 
381 EVENT2_EXPORT_SYMBOL
382 const char *event_base_get_method(const struct event_base *);
383 
396 EVENT2_EXPORT_SYMBOL
397 const char **event_get_supported_methods(void);
398 
402 EVENT2_EXPORT_SYMBOL
403 int event_gettime_monotonic(struct event_base *base, struct timeval *tp);
404 
413 #define EVENT_BASE_COUNT_ACTIVE 1U
414 
416 #define EVENT_BASE_COUNT_VIRTUAL 2U
417 
419 #define EVENT_BASE_COUNT_ADDED 4U
420 
440 EVENT2_EXPORT_SYMBOL
441 int event_base_get_num_events(struct event_base *, unsigned int);
442 
453 EVENT2_EXPORT_SYMBOL
454 int event_base_get_max_events(struct event_base *, unsigned int, int);
455 
466 EVENT2_EXPORT_SYMBOL
467 struct event_config *event_config_new(void);
468 
474 EVENT2_EXPORT_SYMBOL
475 void event_config_free(struct event_config *cfg);
476 
489 EVENT2_EXPORT_SYMBOL
490 int event_config_avoid_method(struct event_config *cfg, const char *method);
491 
519 };
520 
551 
567 
574 };
575 
583 EVENT2_EXPORT_SYMBOL
584 int event_base_get_features(const struct event_base *base);
585 
608 EVENT2_EXPORT_SYMBOL
609 int event_config_require_features(struct event_config *cfg, int feature);
610 
617 EVENT2_EXPORT_SYMBOL
618 int event_config_set_flag(struct event_config *cfg, int flag);
619 
629 EVENT2_EXPORT_SYMBOL
630 int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus);
631 
660 EVENT2_EXPORT_SYMBOL
662  const struct timeval *max_interval, int max_callbacks,
663  int min_priority);
664 
677 EVENT2_EXPORT_SYMBOL
678 struct event_base *event_base_new_with_config(const struct event_config *);
679 
691 EVENT2_EXPORT_SYMBOL
692 void event_base_free(struct event_base *);
693 
697 EVENT2_EXPORT_SYMBOL
699 
703 #define EVENT_LOG_DEBUG 0
704 #define EVENT_LOG_MSG 1
705 #define EVENT_LOG_WARN 2
706 #define EVENT_LOG_ERR 3
707 
709 /* Obsolete names: these are deprecated, but older programs might use them.
710  * They violate the reserved-identifier namespace. */
711 #define _EVENT_LOG_DEBUG EVENT_LOG_DEBUG
712 #define _EVENT_LOG_MSG EVENT_LOG_MSG
713 #define _EVENT_LOG_WARN EVENT_LOG_WARN
714 #define _EVENT_LOG_ERR EVENT_LOG_ERR
715 
721 typedef void (*event_log_cb)(int severity, const char *msg);
732 EVENT2_EXPORT_SYMBOL
734 
740 typedef void (*event_fatal_cb)(int err);
741 
754 EVENT2_EXPORT_SYMBOL
756 
757 #define EVENT_DBG_ALL 0xffffffffu
758 #define EVENT_DBG_NONE 0
759 
774 EVENT2_EXPORT_SYMBOL
775 void event_enable_debug_logging(ev_uint32_t which);
776 
786 EVENT2_EXPORT_SYMBOL
787 int event_base_set(struct event_base *, struct event *);
788 
796 #define EVLOOP_ONCE 0x01
797 
799 #define EVLOOP_NONBLOCK 0x02
800 
804 #define EVLOOP_NO_EXIT_ON_EMPTY 0x04
805 
825 EVENT2_EXPORT_SYMBOL
826 int event_base_loop(struct event_base *, int);
827 
843 EVENT2_EXPORT_SYMBOL
844 int event_base_loopexit(struct event_base *, const struct timeval *);
845 
859 EVENT2_EXPORT_SYMBOL
860 int event_base_loopbreak(struct event_base *);
861 
879 EVENT2_EXPORT_SYMBOL
880 int event_base_loopcontinue(struct event_base *);
881 
894 EVENT2_EXPORT_SYMBOL
895 int event_base_got_exit(struct event_base *);
896 
909 EVENT2_EXPORT_SYMBOL
910 int event_base_got_break(struct event_base *);
911 
921 #define EV_TIMEOUT 0x01
922 
923 #define EV_READ 0x02
924 
925 #define EV_WRITE 0x04
926 
927 #define EV_SIGNAL 0x08
928 
934 #define EV_PERSIST 0x10
935 
936 #define EV_ET 0x20
937 
945 #define EV_FINALIZE 0x40
946 
954 #define EV_CLOSED 0x80
955 
964 #define evtimer_assign(ev, b, cb, arg) \
965  event_assign((ev), (b), -1, 0, (cb), (arg))
966 #define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
967 #define evtimer_add(ev, tv) event_add((ev), (tv))
968 #define evtimer_del(ev) event_del(ev)
969 #define evtimer_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
970 #define evtimer_initialized(ev) event_initialized(ev)
971 
979 #define evsignal_add(ev, tv) event_add((ev), (tv))
980 #define evsignal_assign(ev, b, x, cb, arg) \
981  event_assign((ev), (b), (x), EV_SIGNAL|EV_PERSIST, cb, (arg))
982 #define evsignal_new(b, x, cb, arg) \
983  event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
984 #define evsignal_del(ev) event_del(ev)
985 #define evsignal_pending(ev, tv) event_pending((ev), EV_SIGNAL, (tv))
986 #define evsignal_initialized(ev) event_initialized(ev)
987 
996 #define evuser_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
997 #define evuser_del(ev) event_del(ev)
998 #define evuser_pending(ev, tv) event_pending((ev), 0, (tv))
999 #define evuser_initialized(ev) event_initialized(ev)
1000 #define evuser_trigger(ev) event_active((ev), 0, 0)
1001 
1014 typedef void (*event_callback_fn)(evutil_socket_t, short, void *);
1015 
1038 EVENT2_EXPORT_SYMBOL
1039 void *event_self_cbarg(void);
1040 
1089 EVENT2_EXPORT_SYMBOL
1090 struct event *event_new(struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
1091 
1092 
1131 EVENT2_EXPORT_SYMBOL
1132 int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
1133 
1140 EVENT2_EXPORT_SYMBOL
1141 void event_free(struct event *);
1142 
1146 typedef void (*event_finalize_callback_fn)(struct event *, void *);
1178 EVENT2_EXPORT_SYMBOL
1179 int event_finalize(unsigned, struct event *, event_finalize_callback_fn);
1180 EVENT2_EXPORT_SYMBOL
1181 int event_free_finalize(unsigned, struct event *, event_finalize_callback_fn);
1208 EVENT2_EXPORT_SYMBOL
1209 int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_fn, void *, const struct timeval *);
1210 
1232 EVENT2_EXPORT_SYMBOL
1233 int event_add(struct event *ev, const struct timeval *timeout);
1234 
1244 EVENT2_EXPORT_SYMBOL
1245 int event_remove_timer(struct event *ev);
1246 
1258 EVENT2_EXPORT_SYMBOL
1259 int event_del(struct event *);
1260 
1266 EVENT2_EXPORT_SYMBOL
1267 int event_del_noblock(struct event *ev);
1273 EVENT2_EXPORT_SYMBOL
1274 int event_del_block(struct event *ev);
1275 
1290 EVENT2_EXPORT_SYMBOL
1291 void event_active(struct event *ev, int res, short ncalls);
1292 
1306 EVENT2_EXPORT_SYMBOL
1307 int event_pending(const struct event *ev, short events, struct timeval *tv);
1308 
1315 EVENT2_EXPORT_SYMBOL
1316 struct event *event_base_get_running_event(struct event_base *base);
1317 
1333 EVENT2_EXPORT_SYMBOL
1334 int event_initialized(const struct event *ev);
1335 
1339 #define event_get_signal(ev) ((int)event_get_fd(ev))
1340 
1345 EVENT2_EXPORT_SYMBOL
1346 evutil_socket_t event_get_fd(const struct event *ev);
1347 
1351 EVENT2_EXPORT_SYMBOL
1352 struct event_base *event_get_base(const struct event *ev);
1353 
1357 EVENT2_EXPORT_SYMBOL
1358 short event_get_events(const struct event *ev);
1359 
1363 EVENT2_EXPORT_SYMBOL
1364 event_callback_fn event_get_callback(const struct event *ev);
1365 
1369 EVENT2_EXPORT_SYMBOL
1370 void *event_get_callback_arg(const struct event *ev);
1371 
1376 EVENT2_EXPORT_SYMBOL
1377 int event_get_priority(const struct event *ev);
1378 
1386 EVENT2_EXPORT_SYMBOL
1387 void event_get_assignment(const struct event *event,
1388  struct event_base **base_out, evutil_socket_t *fd_out, short *events_out,
1389  event_callback_fn *callback_out, void **arg_out);
1390 
1404 EVENT2_EXPORT_SYMBOL
1405 size_t event_get_struct_event_size(void);
1406 
1416 EVENT2_EXPORT_SYMBOL
1417 const char *event_get_version(void);
1418 
1430 EVENT2_EXPORT_SYMBOL
1431 ev_uint32_t event_get_version_number(void);
1432 
1434 #define LIBEVENT_VERSION EVENT__VERSION
1435 
1437 #define LIBEVENT_VERSION_NUMBER EVENT__NUMERIC_VERSION
1438 
1440 #define EVENT_MAX_PRIORITIES 256
1441 
1468 EVENT2_EXPORT_SYMBOL
1469 int event_base_priority_init(struct event_base *, int);
1470 
1478 EVENT2_EXPORT_SYMBOL
1479 int event_base_get_npriorities(struct event_base *eb);
1480 
1489 EVENT2_EXPORT_SYMBOL
1490 int event_priority_set(struct event *, int);
1491 
1511 EVENT2_EXPORT_SYMBOL
1512 const struct timeval *event_base_init_common_timeout(struct event_base *base,
1513  const struct timeval *duration);
1514 
1515 #if !defined(EVENT__DISABLE_MM_REPLACEMENT) || defined(EVENT_IN_DOXYGEN_)
1516 
1538 EVENT2_EXPORT_SYMBOL
1540  void *(*malloc_fn)(size_t sz),
1541  void *(*realloc_fn)(void *ptr, size_t sz),
1542  void (*free_fn)(void *ptr));
1545 #define EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
1546 #endif
1547 
1558 EVENT2_EXPORT_SYMBOL
1559 void event_base_dump_events(struct event_base *, FILE *);
1560 
1561 
1572 EVENT2_EXPORT_SYMBOL
1573 void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events);
1574 
1584 EVENT2_EXPORT_SYMBOL
1585 void event_base_active_by_signal(struct event_base *base, int sig);
1586 
1590 typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
1591 
1617 EVENT2_EXPORT_SYMBOL
1618 int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg);
1619 
1620 
1632 EVENT2_EXPORT_SYMBOL
1634  struct timeval *tv);
1635 
1648 EVENT2_EXPORT_SYMBOL
1649 int event_base_update_cache_time(struct event_base *base);
1650 
1665 EVENT2_EXPORT_SYMBOL
1666 void libevent_global_shutdown(void);
1667 
1668 #ifdef __cplusplus
1669 }
1670 #endif
1671 
1672 #endif /* EVENT2_EVENT_H_INCLUDED_ */
EVENT2_EXPORT_SYMBOL void event_config_free(struct event_config *cfg)
Deallocates all memory associated with an event configuration object.
EVENT2_EXPORT_SYMBOL int event_base_get_max_events(struct event_base *, unsigned int, int)
Get the maximum number of events in a given event_base as specified in the flags. ...
EVENT2_EXPORT_SYMBOL int event_base_gettimeofday_cached(struct event_base *base, struct timeval *tv)
Sets &#39;tv&#39; to the current time (as returned by gettimeofday()), looking at the cached value in &#39;base&#39; ...
EVENT2_EXPORT_SYMBOL int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *)
Prepare a new, already-allocated event structure to be added.
EVENT2_EXPORT_SYMBOL int event_priority_set(struct event *, int)
Assign a priority to an event.
Do not check the EVENT_* environment variables when configuring an event_base.
Definition: event.h:539
EVENT2_EXPORT_SYMBOL struct event * event_new(struct event_base *, evutil_socket_t, short, event_callback_fn, void *)
Allocate and assign a new event structure, ready to be added.
EVENT2_EXPORT_SYMBOL void event_free(struct event *)
Deallocate a struct event * returned by event_new().
EVENT2_EXPORT_SYMBOL short event_get_events(const struct event *ev)
Return the events (EV_READ, EV_WRITE, etc) assigned to an event.
EVENT2_EXPORT_SYMBOL void event_set_log_callback(event_log_cb cb)
Redirect Libevent&#39;s log messages.
Configuration for an event_base.
Definition: event.h:295
EVENT2_EXPORT_SYMBOL void * event_get_callback_arg(const struct event *ev)
Return the callback argument assigned to an event.
EVENT2_EXPORT_SYMBOL int event_base_get_features(const struct event_base *base)
Return a bitmask of the features implemented by an event base.
EVENT2_EXPORT_SYMBOL ev_uint32_t event_get_version_number(void)
Return a numeric representation of Libevent&#39;s version.
EVENT2_EXPORT_SYMBOL const char * event_get_version(void)
Get the Libevent version.
EVENT2_EXPORT_SYMBOL int event_config_avoid_method(struct event_config *cfg, const char *method)
Enters an event method that should be avoided into the configuration.
EVENT2_EXPORT_SYMBOL int event_config_require_features(struct event_config *cfg, int feature)
Enters a required event method feature that the application demands.
EVENT2_EXPORT_SYMBOL struct event * event_base_get_running_event(struct event_base *base)
If called from within the callback for an event, returns that event.
EVENT2_EXPORT_SYMBOL void event_debug_unassign(struct event *)
When debugging mode is enabled, informs Libevent that an event should no longer be considered as assi...
EVENT2_EXPORT_SYMBOL struct event_base * event_base_new_with_config(const struct event_config *)
Initialize the event API.
Require an event method where having one event triggered among many is [approximately] an O(1) operat...
Definition: event.h:508
EVENT2_EXPORT_SYMBOL void event_base_dump_events(struct event_base *, FILE *)
Writes a human-readable description of all inserted and/or active events to a provided stdio stream...
Structure to represent a single event.
Definition: event.h:276
EVENT2_EXPORT_SYMBOL size_t event_get_struct_event_size(void)
Return the size of struct event that the Libevent library was compiled with.
Windows only: enable the IOCP dispatcher at startup.
Definition: event.h:546
event_base_config_flag
A flag passed to event_config_set_flag().
Definition: event.h:529
EVENT2_EXPORT_SYMBOL int event_base_got_break(struct event_base *)
Checks if the event loop was told to abort immediately by event_base_loopbreak(). ...
EVENT2_EXPORT_SYMBOL int event_base_loopcontinue(struct event_base *)
Tell the active event_base_loop() to scan for new events immediately.
EVENT2_EXPORT_SYMBOL void event_base_free_nofinalize(struct event_base *)
As event_base_free, but do not run finalizers.
EVENT2_EXPORT_SYMBOL int event_gettime_monotonic(struct event_base *base, struct timeval *tp)
Query the current monotonic time from a the timer for a struct event_base.
EVENT2_EXPORT_SYMBOL int event_base_got_exit(struct event_base *)
Checks if the event loop was told to exit by event_base_loopexit().
EVENT2_EXPORT_SYMBOL const char * event_base_get_method(const struct event_base *)
Get the kernel event notification mechanism used by Libevent.
#define evutil_socket_t
A type wide enough to hold the output of &quot;socket()&quot; or &quot;accept()&quot;.
Definition: util.h:310
EVENT2_EXPORT_SYMBOL int event_add(struct event *ev, const struct timeval *timeout)
Add an event to the set of pending events.
EVENT2_EXPORT_SYMBOL void event_enable_debug_logging(ev_uint32_t which)
Turn on debugging logs and have them sent to the default log handler.
EVENT2_EXPORT_SYMBOL int event_base_dispatch(struct event_base *)
Event dispatching loop.
EVENT2_EXPORT_SYMBOL void libevent_global_shutdown(void)
Release up all globally-allocated resources allocated by Libevent.
EVENT2_EXPORT_SYMBOL int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_fn, void *, const struct timeval *)
Schedule a one-time event.
void(* event_log_cb)(int severity, const char *msg)
A callback function used to intercept Libevent&#39;s log messages.
Definition: event.h:721
EVENT2_EXPORT_SYMBOL int event_del(struct event *)
Remove an event from the set of monitored events.
EVENT2_EXPORT_SYMBOL int event_base_loop(struct event_base *, int)
Wait for events to become active, and run their callbacks.
EVENT2_EXPORT_SYMBOL struct timeval * event_base_init_common_timeout(struct event_base *base, const struct timeval *duration)
Prepare an event_base to use a large number of timeouts with the same duration.
EVENT2_EXPORT_SYMBOL int event_initialized(const struct event *ev)
Test if an event structure might be initialized.
EVENT2_EXPORT_SYMBOL void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events)
Activates all pending events for the given fd and event mask.
EVENT2_EXPORT_SYMBOL int event_config_set_max_dispatch_interval(struct event_config *cfg, const struct timeval *max_interval, int max_callbacks, int min_priority)
Record an interval and/or a number of callbacks after which the event base should check for new event...
event_method_feature
A flag used to describe which features an event_base (must) provide.
Definition: event.h:501
EVENT2_EXPORT_SYMBOL void event_enable_debug_mode(void)
Enable some relatively expensive debugging checks in Libevent that would normally be turned off...
EVENT2_EXPORT_SYMBOL void event_get_assignment(const struct event *event, struct event_base **base_out, evutil_socket_t *fd_out, short *events_out, event_callback_fn *callback_out, void **arg_out)
Extract all of arguments given to construct a given event.
Common convenience functions for cross-platform portability and related socket manipulations.
EVENT2_EXPORT_SYMBOL int event_del_block(struct event *ev)
As event_del(), but always blocks while the event&#39;s callback is running in another thread...
EVENT2_EXPORT_SYMBOL int event_base_get_num_events(struct event_base *, unsigned int)
Gets the number of events in event_base, as specified in the flags.
EVENT2_EXPORT_SYMBOL int event_base_set(struct event_base *, struct event *)
Associate a different event base with an event.
Ordinarily, Libevent implements its time and timeout code using the fastest monotonic timer that we h...
Definition: event.h:573
void(* event_callback_fn)(evutil_socket_t, short, void *)
A callback function for an event.
Definition: event.h:1014
EVENT2_EXPORT_SYMBOL struct event_base * event_get_base(const struct event *ev)
Get the event_base associated with an event.
EVENT2_EXPORT_SYMBOL int event_remove_timer(struct event *ev)
Remove a timer from a pending event without removing the event itself.
EVENT2_EXPORT_SYMBOL event_callback_fn event_get_callback(const struct event *ev)
Return the callback assigned to an event.
void(* event_finalize_callback_fn)(struct event *, void *)
Callback type for event_finalize and event_free_finalize().
Definition: event.h:1146
Do not allocate a lock for the event base, even if we have locking set up.
Definition: event.h:536
void(* event_fatal_cb)(int err)
A function to be called if Libevent encounters a fatal internal error.
Definition: event.h:740
EVENT2_EXPORT_SYMBOL int event_config_set_flag(struct event_config *cfg, int flag)
Sets one or more flags to configure what parts of the eventual event_base will be initialized...
EVENT2_EXPORT_SYMBOL int event_base_loopexit(struct event_base *, const struct timeval *)
Exit the event loop after the specified time.
EVENT2_EXPORT_SYMBOL int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg)
Iterate over all added or active events events in an event loop, and invoke a given callback on each ...
EVENT2_EXPORT_SYMBOL void event_set_fatal_callback(event_fatal_cb cb)
Override Libevent&#39;s behavior in the event of a fatal internal error.
EVENT2_EXPORT_SYMBOL void event_active(struct event *ev, int res, short ncalls)
Make an event active.
Require an event method that allows you to use EV_CLOSED to detect connection close without the neces...
Definition: event.h:518
EVENT2_EXPORT_SYMBOL void event_base_active_by_signal(struct event_base *base, int sig)
Activates all pending signals with a given signal number.
EVENT2_EXPORT_SYMBOL int event_base_get_npriorities(struct event_base *eb)
Get the number of different event priorities.
EVENT2_EXPORT_SYMBOL int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus)
Records a hint for the number of CPUs in the system.
EVENT2_EXPORT_SYMBOL int event_reinit(struct event_base *base)
Reinitialize the event base after a fork.
EVENT2_EXPORT_SYMBOL int event_del_noblock(struct event *ev)
As event_del(), but never blocks while the event&#39;s callback is running in another thread...
EVENT2_EXPORT_SYMBOL void * event_self_cbarg(void)
Return a value used to specify that the event itself must be used as the callback argument...
Instead of checking the current time every time the event loop is ready to run timeout callbacks...
Definition: event.h:550
EVENT2_EXPORT_SYMBOL const char ** event_get_supported_methods(void)
Gets all event notification mechanisms supported by Libevent.
If we are using the epoll backend, this flag says that it is safe to use Libevent&#39;s internal change-l...
Definition: event.h:566
EVENT2_EXPORT_SYMBOL void event_base_free(struct event_base *)
Deallocate all memory associated with an event_base, and free the base.
EVENT2_EXPORT_SYMBOL struct event_base * event_base_new(void)
Create and return a new event_base to use with the rest of Libevent.
EVENT2_EXPORT_SYMBOL int event_get_priority(const struct event *ev)
Return the priority of an event.
EVENT2_EXPORT_SYMBOL int event_base_priority_init(struct event_base *, int)
Set the number of different event priorities.
EVENT2_EXPORT_SYMBOL void event_set_mem_functions(void *(*malloc_fn)(size_t sz), void *(*realloc_fn)(void *ptr, size_t sz), void(*free_fn)(void *ptr))
Override the functions that Libevent uses for memory management.
EVENT2_EXPORT_SYMBOL struct event_config * event_config_new(void)
Allocates a new event configuration object.
EVENT2_EXPORT_SYMBOL evutil_socket_t event_get_fd(const struct event *ev)
Get the socket or signal assigned to an event, or -1 if the event has no socket.
Structure to hold information and state for a Libevent dispatch loop.
Definition: event.h:217
EVENT2_EXPORT_SYMBOL int event_base_loopbreak(struct event_base *)
Abort the active event_base_loop() immediately.
int(* event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *)
Callback for iterating events in an event base via event_base_foreach_event.
Definition: event.h:1590
EVENT2_EXPORT_SYMBOL int event_pending(const struct event *ev, short events, struct timeval *tv)
Checks if a specific event is pending or scheduled.
Require an event method that allows edge-triggered events with EV_ET.
Definition: event.h:503
EVENT2_EXPORT_SYMBOL int event_base_update_cache_time(struct event_base *base)
Update cached_tv in the &#39;base&#39; to the current time.
Require an event method that allows file descriptors as well as sockets.
Definition: event.h:511