1 .TH "event2/event_compat.h" 3 "Tue Jan 27 2015" "libevent" \" -*- nroff -*-
5 event2/event_compat.h \-
7 Potentially non-threadsafe versions of the functions in \fBevent\&.h\fP: provided only for backwards compatibility\&.
12 \fC#include <event2/event-config\&.h>\fP
14 \fC#include <event2/util\&.h>\fP
21 .RI "#define \fBEVENT_FD\fP(ev) ((int)\fBevent_get_fd\fP(ev))"
24 .RI "#define \fBEVENT_SIGNAL\fP(ev) \fBevent_get_signal\fP(ev)"
27 .RI "#define \fBevsignal_set\fP(ev, x, cb, arg) \fBevent_set\fP((ev), (x), \fBEV_SIGNAL\fP|\fBEV_PERSIST\fP, (cb), (arg))"
30 .RI "#define \fBevtimer_set\fP(ev, cb, arg) \fBevent_set\fP((ev), -1, 0, (cb), (arg))"
34 .RI "\fBtimeout_* macros\fP"
40 These macros are deprecated because their naming is inconsistent with the rest of Libevent\&. Use the evtimer_* macros instead\&.
48 .RI "#define \fBtimeout_add\fP(ev, tv) \fBevent_add\fP((ev), (tv))"
51 .RI "#define \fBtimeout_set\fP(ev, cb, arg) \fBevent_set\fP((ev), -1, 0, (cb), (arg))"
54 .RI "#define \fBtimeout_del\fP(ev) \fBevent_del\fP(ev)"
57 .RI "#define \fBtimeout_pending\fP(ev, tv) \fBevent_pending\fP((ev), \fBEV_TIMEOUT\fP, (tv))"
60 .RI "#define \fBtimeout_initialized\fP(ev) \fBevent_initialized\fP(ev)"
65 .RI "\fBsignal_* macros\fP"
71 These macros are deprecated because their naming is inconsistent with the rest of Libevent\&. Use the evsignal_* macros instead\&.
79 .RI "#define \fBsignal_add\fP(ev, tv) \fBevent_add\fP((ev), (tv))"
82 .RI "#define \fBsignal_set\fP(ev, x, cb, arg) \fBevent_set\fP((ev), (x), \fBEV_SIGNAL\fP|\fBEV_PERSIST\fP, (cb), (arg))"
85 .RI "#define \fBsignal_del\fP(ev) \fBevent_del\fP(ev)"
88 .RI "#define \fBsignal_pending\fP(ev, tv) \fBevent_pending\fP((ev), \fBEV_SIGNAL\fP, (tv))"
91 .RI "#define \fBsignal_initialized\fP(ev) \fBevent_initialized\fP(ev)"
99 .RI "int \fBevent_dispatch\fP (void)"
101 .RI "\fILoop to process events\&. \fP"
103 .RI "const char * \fBevent_get_method\fP (void)"
105 .RI "\fIGet the kernel event notification mechanism used by Libevent\&. \fP"
107 .RI "struct \fBevent_base\fP * \fBevent_init\fP (void)"
109 .RI "\fIInitialize the event API\&. \fP"
111 .RI "int \fBevent_loop\fP (int)"
113 .RI "\fIHandle events\&. \fP"
115 .RI "int \fBevent_loopbreak\fP (void)"
117 .RI "\fIAbort the active \fBevent_loop()\fP immediately\&. \fP"
119 .RI "int \fBevent_loopexit\fP (const struct timeval *)"
121 .RI "\fIExit the event loop after the specified time\&. \fP"
123 .RI "int \fBevent_once\fP (\fBevutil_socket_t\fP, short, void(*)(\fBevutil_socket_t\fP, short, void *), void *, const struct timeval *)"
125 .RI "\fISchedule a one-time event to occur\&. \fP"
127 .RI "int \fBevent_priority_init\fP (int)"
129 .RI "\fISet the number of different event priorities\&. \fP"
131 .RI "void \fBevent_set\fP (struct \fBevent\fP *, \fBevutil_socket_t\fP, short, void(*)(\fBevutil_socket_t\fP, short, void *), void *)"
133 .RI "\fIPrepare an event structure to be added\&. \fP"
135 .SH "Detailed Description"
137 Potentially non-threadsafe versions of the functions in \fBevent\&.h\fP: provided only for backwards compatibility\&.
139 In the oldest versions of Libevent, \fBevent_base\fP was not a first-class structure\&. Instead, there was a single event base that every function manipulated\&. Later, when separate event bases were added, the old functions that didn't take an \fBevent_base\fP argument needed to work by manipulating the 'current' event base\&. This could lead to thread-safety issues, and obscure, hard-to-diagnose bugs\&.
143 All functions in this file are by definition deprecated\&.
147 .SH "Function Documentation"
149 .SS "int event_dispatch (void)"
152 Loop to process events\&. Like \fBevent_base_dispatch()\fP, but uses the 'current' base\&.
156 This function is deprecated because it is easily confused by multiple calls to \fBevent_init()\fP, and because it is not safe for multithreaded use\&. The replacement is \fBevent_base_dispatch()\fP\&.
162 \fBevent_base_dispatch()\fP, \fBevent_init()\fP
166 .SS "const char* event_get_method (void)"
169 Get the kernel event notification mechanism used by Libevent\&.
173 This function is obsolete, and has been replaced by \fBevent_base_get_method()\fP\&. Its use is deprecated because it relies on the 'current' base configured by \fBevent_init()\fP\&.
179 \fBevent_base_get_method()\fP
183 .SS "struct \fBevent_base\fP* event_init (void)"
186 Initialize the event API\&. The event API needs to be initialized with \fBevent_init()\fP before it can be used\&. Sets the global current base that gets used for events that have no base associated with them\&.
190 This function is deprecated because it replaces the 'current' \fBevent_base\fP, and is totally unsafe for multithreaded use\&. The replacement is \fBevent_base_new()\fP\&.
196 \fBevent_base_set()\fP, \fBevent_base_new()\fP
200 .SS "int event_loop (int)"
203 Handle events\&. This function behaves like \fBevent_base_loop()\fP, but uses the 'current' base
207 This function is deprecated because it uses the event base from the last call to event_init, and is therefore not safe for multithreaded use\&. The replacement is \fBevent_base_loop()\fP\&.
213 \fBevent_base_loop()\fP, \fBevent_init()\fP
217 .SS "int event_loopbreak (void)"
220 Abort the active \fBevent_loop()\fP immediately\&. This function behaves like event_base_loopbreakt(), except that it uses the 'current' base\&.
224 This function is deprecated because it uses the event base from the last call to event_init, and is therefore not safe for multithreaded use\&. The replacement is \fBevent_base_loopbreak()\fP\&.
230 \fBevent_base_loopbreak()\fP, \fBevent_init()\fP
234 .SS "int event_loopexit (const struct timeval *)"
237 Exit the event loop after the specified time\&. This function behaves like \fBevent_base_loopexit()\fP, except that it uses the 'current' base\&.
241 This function is deprecated because it uses the event base from the last call to event_init, and is therefore not safe for multithreaded use\&. The replacement is \fBevent_base_loopexit()\fP\&.
247 \fBevent_init\fP, \fBevent_base_loopexit()\fP
251 .SS "int event_once (\fBevutil_socket_t\fP, short, void(*)(\fBevutil_socket_t\fP, short, void *), void *, const struct timeval *)"
254 Schedule a one-time event to occur\&.
258 This function is obsolete, and has been replaced by \fBevent_base_once()\fP\&. Its use is deprecated because it relies on the 'current' base configured by \fBevent_init()\fP\&.
264 \fBevent_base_once()\fP
268 .SS "int event_priority_init (int)"
271 Set the number of different event priorities\&.
275 This function is deprecated because it is easily confused by multiple calls to \fBevent_init()\fP, and because it is not safe for multithreaded use\&. The replacement is \fBevent_base_priority_init()\fP\&.
281 \fBevent_base_priority_init()\fP
285 .SS "void event_set (struct \fBevent\fP *, \fBevutil_socket_t\fP, short, void(*)(\fBevutil_socket_t\fP, short, void *), void *)"
288 Prepare an event structure to be added\&.
292 \fBevent_set()\fP is not recommended for new code, because it requires a subsequent call to \fBevent_base_set()\fP to be safe under most circumstances\&. Use \fBevent_assign()\fP or \fBevent_new()\fP instead\&.
298 Generated automatically by Doxygen for libevent from the source code\&.