ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.h
(Generate patch)

Comparing libev/ev.h (file contents):
Revision 1.135 by root, Tue Mar 16 00:26:41 2010 UTC vs.
Revision 1.138 by root, Tue Mar 16 20:32:20 2010 UTC

45#endif 45#endif
46 46
47/*****************************************************************************/ 47/*****************************************************************************/
48 48
49#ifndef EV_FEATURES 49#ifndef EV_FEATURES
50# define EV_FEATURES 0x3f 50# define EV_FEATURES 0x7f
51#endif 51#endif
52 52
53#define EV_FEATURE_CODE ((EV_FEATURES) & 1) 53#define EV_FEATURE_CODE ((EV_FEATURES) & 1)
54#define EV_FEATURE_DATA ((EV_FEATURES) & 2) 54#define EV_FEATURE_DATA ((EV_FEATURES) & 2)
55#define EV_FEATURE_CONFIG ((EV_FEATURES) & 4)
55#define EV_FEATURE_API ((EV_FEATURES) & 4) 56#define EV_FEATURE_API ((EV_FEATURES) & 8)
56#define EV_FEATURE_WATCHERS ((EV_FEATURES) & 8) 57#define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16)
57#define EV_FEATURE_BACKENDS ((EV_FEATURES) & 16) 58#define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32)
58#define EV_FEATURE_OS ((EV_FEATURES) & 32) 59#define EV_FEATURE_OS ((EV_FEATURES) & 64)
59 60
60/* these priorities are inclusive, higher priorities will be called earlier */ 61/* these priorities are inclusive, higher priorities will be invoked earlier */
61#ifndef EV_MINPRI 62#ifndef EV_MINPRI
62# define EV_MINPRI (EV_FEATURE_API ? -2 : 0) 63# define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0)
63#endif 64#endif
64#ifndef EV_MAXPRI 65#ifndef EV_MAXPRI
65# define EV_MAXPRI (EV_FEATURE_API ? +2 : 0) 66# define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0)
66#endif 67#endif
67 68
68#ifndef EV_MULTIPLICITY 69#ifndef EV_MULTIPLICITY
69# define EV_MULTIPLICITY EV_FEATURE_API 70# define EV_MULTIPLICITY EV_FEATURE_CONFIG
70#endif 71#endif
71 72
72#ifndef EV_PERIODIC_ENABLE 73#ifndef EV_PERIODIC_ENABLE
73# define EV_PERIODIC_ENABLE EV_FEATURE_WATCHERS 74# define EV_PERIODIC_ENABLE EV_FEATURE_WATCHERS
74#endif 75#endif
168# define EV_INLINE static inline 169# define EV_INLINE static inline
169#else 170#else
170# define EV_INLINE static 171# define EV_INLINE static
171#endif 172#endif
172 173
174#ifndef EV_PROTOTYPES
175# define EV_PROTOTYPES 1
176#endif
177
173/*****************************************************************************/ 178/*****************************************************************************/
179
180#define EV_VERSION_MAJOR 4
181#define EV_VERSION_MINOR 0
174 182
175/* eventmask, revents, events... */ 183/* eventmask, revents, events... */
176#define EV_UNDEF -1 /* guaranteed to be invalid */ 184#define EV_UNDEF -1 /* guaranteed to be invalid */
177#define EV_NONE 0x00 /* no events */ 185#define EV_NONE 0x00 /* no events */
178#define EV_READ 0x01 /* ev_io detected read will not block */ 186#define EV_READ 0x01 /* ev_io detected read will not block */
196 204
197/* can be used to add custom fields to all watchers, while losing binary compatibility */ 205/* can be used to add custom fields to all watchers, while losing binary compatibility */
198#ifndef EV_COMMON 206#ifndef EV_COMMON
199# define EV_COMMON void *data; 207# define EV_COMMON void *data;
200#endif 208#endif
201#ifndef EV_PROTOTYPES
202# define EV_PROTOTYPES 1
203#endif
204
205#define EV_VERSION_MAJOR 3
206#define EV_VERSION_MINOR 9
207 209
208#ifndef EV_CB_DECLARE 210#ifndef EV_CB_DECLARE
209# define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents); 211# define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents);
210#endif 212#endif
211#ifndef EV_CB_INVOKE 213#ifndef EV_CB_INVOKE
212# define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents)) 214# define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents))
213#endif 215#endif
216
217/* not official, do not use */
218#define EV_CB(type,name) void name (EV_P_ struct ev_ ## type *w, int revents)
214 219
215/* 220/*
216 * struct member types: 221 * struct member types:
217 * private: you may look at them, but not change them, 222 * private: you may look at them, but not change them,
218 * and they might not mean anything to you. 223 * and they might not mean anything to you.
229 * or the array index + 1 in the pendings array. 234 * or the array index + 1 in the pendings array.
230 */ 235 */
231 236
232#if EV_MINPRI == EV_MAXPRI 237#if EV_MINPRI == EV_MAXPRI
233# define EV_DECL_PRIORITY 238# define EV_DECL_PRIORITY
234#else 239#elif !defined (EV_DECL_PRIORITY)
235# define EV_DECL_PRIORITY int priority; 240# define EV_DECL_PRIORITY int priority;
236#endif 241#endif
237 242
238/* shared by all watchers */ 243/* shared by all watchers */
239#define EV_WATCHER(type) \ 244#define EV_WATCHER(type) \
583 * if timeout is < 0, do wait indefinitely 588 * if timeout is < 0, do wait indefinitely
584 */ 589 */
585void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg); 590void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg);
586 591
587# if EV_FEATURE_API 592# if EV_FEATURE_API
588unsigned int ev_loop_count (EV_P); /* number of loop iterations */ 593unsigned int ev_iteration (EV_P); /* number of loop iterations */
589unsigned int ev_loop_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */ 594unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */
590void ev_loop_verify (EV_P); /* abort if loop data corrupted */ 595void ev_verify (EV_P); /* abort if loop data corrupted */
596
597/* pre 4.0 API */
598# if EV_MULTIPLICITY
599# define ev_loop_count(l) ev_iteration (l)
600# define ev_loop_depth(l) ev_depth (l)
601# endif
591 602
592void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ 603void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
593void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ 604void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
594 605
595/* advanced stuff for threading etc. support, see docs */ 606/* advanced stuff for threading etc. support, see docs */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines