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

Comparing libev/ev.h (file contents):
Revision 1.134 by root, Tue Mar 16 00:20:17 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_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
123# undef EV_SIGNAL_ENABLE 124# undef EV_SIGNAL_ENABLE
124# define EV_SIGNAL_ENABLE 1 125# define EV_SIGNAL_ENABLE 1
125#endif 126#endif
126 127
127/*****************************************************************************/ 128/*****************************************************************************/
128
129#if !EV_FEATURE_CODE && !defined (NDEBUG)
130# define NDEBUG 1
131# include <assert.h>
132#endif
133 129
134typedef double ev_tstamp; 130typedef double ev_tstamp;
135 131
136#ifndef EV_ATOMIC_T 132#ifndef EV_ATOMIC_T
137# include <signal.h> 133# include <signal.h>
173# define EV_INLINE static inline 169# define EV_INLINE static inline
174#else 170#else
175# define EV_INLINE static 171# define EV_INLINE static
176#endif 172#endif
177 173
174#ifndef EV_PROTOTYPES
175# define EV_PROTOTYPES 1
176#endif
177
178/*****************************************************************************/ 178/*****************************************************************************/
179
180#define EV_VERSION_MAJOR 4
181#define EV_VERSION_MINOR 0
179 182
180/* eventmask, revents, events... */ 183/* eventmask, revents, events... */
181#define EV_UNDEF -1 /* guaranteed to be invalid */ 184#define EV_UNDEF -1 /* guaranteed to be invalid */
182#define EV_NONE 0x00 /* no events */ 185#define EV_NONE 0x00 /* no events */
183#define EV_READ 0x01 /* ev_io detected read will not block */ 186#define EV_READ 0x01 /* ev_io detected read will not block */
184#define EV_WRITE 0x02 /* ev_io detected write will not block */ 187#define EV_WRITE 0x02 /* ev_io detected write will not block */
185#define EV__IOFDSET 0x80 /* internal use only */ 188#define EV__IOFDSET 0x80 /* internal use only */
186#define EV_IO EV_READ /* alias for type-detection */ 189#define EV_IO EV_READ /* alias for type-detection */
187#define EV_TIMEOUT 0x00000100 /* timer timed out */ 190#define EV_TIMER 0x00000100 /* timer timed out */
188#define EV_TIMER EV_TIMEOUT /* alias for type-detection */ 191#define EV_TIMEOUT EV_TIMER /* pre 4.0 API compatibility */
189#define EV_PERIODIC 0x00000200 /* periodic timer timed out */ 192#define EV_PERIODIC 0x00000200 /* periodic timer timed out */
190#define EV_SIGNAL 0x00000400 /* signal was received */ 193#define EV_SIGNAL 0x00000400 /* signal was received */
191#define EV_CHILD 0x00000800 /* child/pid had status change */ 194#define EV_CHILD 0x00000800 /* child/pid had status change */
192#define EV_STAT 0x00001000 /* stat data changed */ 195#define EV_STAT 0x00001000 /* stat data changed */
193#define EV_IDLE 0x00002000 /* event loop is idling */ 196#define EV_IDLE 0x00002000 /* event loop is idling */
201 204
202/* 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 */
203#ifndef EV_COMMON 206#ifndef EV_COMMON
204# define EV_COMMON void *data; 207# define EV_COMMON void *data;
205#endif 208#endif
206#ifndef EV_PROTOTYPES
207# define EV_PROTOTYPES 1
208#endif
209
210#define EV_VERSION_MAJOR 3
211#define EV_VERSION_MINOR 9
212 209
213#ifndef EV_CB_DECLARE 210#ifndef EV_CB_DECLARE
214# 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);
215#endif 212#endif
216#ifndef EV_CB_INVOKE 213#ifndef EV_CB_INVOKE
217# 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))
218#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)
219 219
220/* 220/*
221 * struct member types: 221 * struct member types:
222 * private: you may look at them, but not change them, 222 * private: you may look at them, but not change them,
223 * and they might not mean anything to you. 223 * and they might not mean anything to you.
234 * or the array index + 1 in the pendings array. 234 * or the array index + 1 in the pendings array.
235 */ 235 */
236 236
237#if EV_MINPRI == EV_MAXPRI 237#if EV_MINPRI == EV_MAXPRI
238# define EV_DECL_PRIORITY 238# define EV_DECL_PRIORITY
239#else 239#elif !defined (EV_DECL_PRIORITY)
240# define EV_DECL_PRIORITY int priority; 240# define EV_DECL_PRIORITY int priority;
241#endif 241#endif
242 242
243/* shared by all watchers */ 243/* shared by all watchers */
244#define EV_WATCHER(type) \ 244#define EV_WATCHER(type) \
588 * if timeout is < 0, do wait indefinitely 588 * if timeout is < 0, do wait indefinitely
589 */ 589 */
590void 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);
591 591
592# if EV_FEATURE_API 592# if EV_FEATURE_API
593unsigned int ev_loop_count (EV_P); /* number of loop iterations */ 593unsigned int ev_iteration (EV_P); /* number of loop iterations */
594unsigned int ev_loop_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */ 594unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */
595void 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
596 603
597void 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 */
598void 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 */
599 606
600/* 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