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

Comparing libev/ev.h (file contents):
Revision 1.136 by root, Tue Mar 16 00:43:22 2010 UTC vs.
Revision 1.139 by root, Tue Mar 16 20:49:47 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_CONFIG ((EV_FEATURES) & 4)
56#define EV_FEATURE_API ((EV_FEATURES) & 8) 56#define EV_FEATURE_API ((EV_FEATURES) & 8)
57#define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16) 57#define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16)
58#define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32) 58#define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32)
59#define EV_FEATURE_OS ((EV_FEATURES) & 64) 59#define EV_FEATURE_OS ((EV_FEATURES) & 64)
60 60
61/* these priorities are inclusive, higher priorities will be called earlier */ 61/* these priorities are inclusive, higher priorities will be invoked earlier */
62#ifndef EV_MINPRI 62#ifndef EV_MINPRI
63# define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0) 63# define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0)
64#endif 64#endif
65#ifndef EV_MAXPRI 65#ifndef EV_MAXPRI
66# define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0) 66# define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0)
169# define EV_INLINE static inline 169# define EV_INLINE static inline
170#else 170#else
171# define EV_INLINE static 171# define EV_INLINE static
172#endif 172#endif
173 173
174#ifndef EV_PROTOTYPES
175# define EV_PROTOTYPES 1
176#endif
177
174/*****************************************************************************/ 178/*****************************************************************************/
179
180#define EV_VERSION_MAJOR 4
181#define EV_VERSION_MINOR 0
175 182
176/* eventmask, revents, events... */ 183/* eventmask, revents, events... */
177#define EV_UNDEF -1 /* guaranteed to be invalid */ 184#define EV_UNDEF -1 /* guaranteed to be invalid */
178#define EV_NONE 0x00 /* no events */ 185#define EV_NONE 0x00 /* no events */
179#define EV_READ 0x01 /* ev_io detected read will not block */ 186#define EV_READ 0x01 /* ev_io detected read will not block */
180#define EV_WRITE 0x02 /* ev_io detected write will not block */ 187#define EV_WRITE 0x02 /* ev_io detected write will not block */
181#define EV__IOFDSET 0x80 /* internal use only */ 188#define EV__IOFDSET 0x80 /* internal use only */
182#define EV_IO EV_READ /* alias for type-detection */ 189#define EV_IO EV_READ /* alias for type-detection */
183#define EV_TIMEOUT 0x00000100 /* timer timed out */ 190#define EV_TIMER 0x00000100 /* timer timed out */
184#define EV_TIMER EV_TIMEOUT /* alias for type-detection */ 191#define EV_TIMEOUT EV_TIMER /* pre 4.0 API compatibility */
185#define EV_PERIODIC 0x00000200 /* periodic timer timed out */ 192#define EV_PERIODIC 0x00000200 /* periodic timer timed out */
186#define EV_SIGNAL 0x00000400 /* signal was received */ 193#define EV_SIGNAL 0x00000400 /* signal was received */
187#define EV_CHILD 0x00000800 /* child/pid had status change */ 194#define EV_CHILD 0x00000800 /* child/pid had status change */
188#define EV_STAT 0x00001000 /* stat data changed */ 195#define EV_STAT 0x00001000 /* stat data changed */
189#define EV_IDLE 0x00002000 /* event loop is idling */ 196#define EV_IDLE 0x00002000 /* event loop is idling */
197 204
198/* 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 */
199#ifndef EV_COMMON 206#ifndef EV_COMMON
200# define EV_COMMON void *data; 207# define EV_COMMON void *data;
201#endif 208#endif
202#ifndef EV_PROTOTYPES
203# define EV_PROTOTYPES 1
204#endif
205
206#define EV_VERSION_MAJOR 3
207#define EV_VERSION_MINOR 9
208 209
209#ifndef EV_CB_DECLARE 210#ifndef EV_CB_DECLARE
210# 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);
211#endif 212#endif
212#ifndef EV_CB_INVOKE 213#ifndef EV_CB_INVOKE
213# 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))
214#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)
215 219
216/* 220/*
217 * struct member types: 221 * struct member types:
218 * private: you may look at them, but not change them, 222 * private: you may look at them, but not change them,
219 * and they might not mean anything to you. 223 * and they might not mean anything to you.
230 * or the array index + 1 in the pendings array. 234 * or the array index + 1 in the pendings array.
231 */ 235 */
232 236
233#if EV_MINPRI == EV_MAXPRI 237#if EV_MINPRI == EV_MAXPRI
234# define EV_DECL_PRIORITY 238# define EV_DECL_PRIORITY
235#else 239#elif !defined (EV_DECL_PRIORITY)
236# define EV_DECL_PRIORITY int priority; 240# define EV_DECL_PRIORITY int priority;
237#endif 241#endif
238 242
239/* shared by all watchers */ 243/* shared by all watchers */
240#define EV_WATCHER(type) \ 244#define EV_WATCHER(type) \
584 * if timeout is < 0, do wait indefinitely 588 * if timeout is < 0, do wait indefinitely
585 */ 589 */
586void 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);
587 591
588# if EV_FEATURE_API 592# if EV_FEATURE_API
589unsigned int ev_loop_count (EV_P); /* number of loop iterations */ 593unsigned int ev_iteration (EV_P); /* number of loop iterations */
590unsigned int ev_loop_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */ 594unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */
591void 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 compatibility */
598# if EV_MULTIPLICITY
599# define ev_loop_count(l) ev_iteration (l)
600# define ev_loop_depth(l) ev_depth (l)
601# define ev_loop_verify(l) ev_verify (l)
602# endif
592 603
593void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ 604void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
594void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ 605void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
595 606
596/* advanced stuff for threading etc. support, see docs */ 607/* advanced stuff for threading etc. support, see docs */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines