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

Comparing libev/ev.h (file contents):
Revision 1.55 by root, Mon Nov 12 06:34:50 2007 UTC vs.
Revision 1.63 by root, Fri Nov 23 05:00:45 2007 UTC

69# define EV_DEFAULT_A 69# define EV_DEFAULT_A
70# define EV_DEFAULT_A_ 70# define EV_DEFAULT_A_
71#endif 71#endif
72 72
73/* eventmask, revents, events... */ 73/* eventmask, revents, events... */
74#define EV_UNDEF -1 /* guaranteed to be invalid */ 74#define EV_UNDEF -1L /* guaranteed to be invalid */
75#define EV_NONE 0x00 75#define EV_NONE 0x00L
76#define EV_READ 0x01 /* io only */ 76#define EV_READ 0x01L /* io only */
77#define EV_WRITE 0x02 /* io only */ 77#define EV_WRITE 0x02L /* io only */
78#define EV_TIMEOUT 0x000100 /* timer only */ 78#define EV_TIMEOUT 0x000100L /* timer only */
79#define EV_PERIODIC 0x000200 /* periodic timer only */ 79#define EV_PERIODIC 0x000200L /* periodic timer only */
80#define EV_SIGNAL 0x000400 /* signal only */ 80#define EV_SIGNAL 0x000400L /* signal only */
81#define EV_IDLE 0x000800 /* idle only */ 81#define EV_IDLE 0x000800L /* idle only */
82#define EV_CHECK 0x001000 /* check only */ 82#define EV_CHECK 0x001000L /* check only */
83#define EV_PREPARE 0x002000 /* prepare only */ 83#define EV_PREPARE 0x002000L /* prepare only */
84#define EV_CHILD 0x004000 /* child/pid only */ 84#define EV_CHILD 0x004000L /* child/pid only */
85#define EV_ERROR 0x800000 /* sent when an error occurs */ 85#define EV_ERROR 0x800000L /* sent when an error occurs */
86 86
87/* can be used to add custom fields to all watchers, while losing binary compatibility */ 87/* can be used to add custom fields to all watchers, while losing binary compatibility */
88#ifndef EV_COMMON 88#ifndef EV_COMMON
89# define EV_COMMON void *data; 89# define EV_COMMON void *data;
90#endif 90#endif
201struct ev_check 201struct ev_check
202{ 202{
203 EV_WATCHER (ev_check) 203 EV_WATCHER (ev_check)
204}; 204};
205 205
206/* invoked when sigchld is received and waitpid indicates the givne pid */ 206/* invoked when sigchld is received and waitpid indicates the given pid */
207/* revent EV_CHILD */ 207/* revent EV_CHILD */
208/* does not support priorities */ 208/* does not support priorities */
209struct ev_child 209struct ev_child
210{ 210{
211 EV_WATCHER_LIST (ev_child) 211 EV_WATCHER_LIST (ev_child)
231 struct ev_child child; 231 struct ev_child child;
232}; 232};
233 233
234/* bits for ev_default_loop and ev_loop_new */ 234/* bits for ev_default_loop and ev_loop_new */
235/* the default */ 235/* the default */
236#define EVFLAG_AUTO 0x00000000 /* not quite a mask */ 236#define EVFLAG_AUTO 0x00000000UL /* not quite a mask */
237 237/* flag bits */
238#define EVFLAG_NOENV 0x01000000UL /* do NOT consult environment */
238/* method bits to be ored together */ 239/* method bits to be ored together */
239#define EVMETHOD_SELECT 0x00000001 /* about anywhere */ 240#define EVBACKEND_SELECT 0x00000001UL /* about anywhere */
240#define EVMETHOD_POLL 0x00000002 /* !win */ 241#define EVBACKEND_POLL 0x00000002UL /* !win */
241#define EVMETHOD_EPOLL 0x00000004 /* linux */ 242#define EVBACKEND_EPOLL 0x00000004UL /* linux */
242#define EVMETHOD_KQUEUE 0x00000008 /* bsd */ 243#define EVBACKEND_KQUEUE 0x00000008UL /* bsd */
243#define EVMETHOD_DEVPOLL 0x00000010 /* solaris 8 */ /* NYI */ 244#define EVBACKEND_DEVPOLL 0x00000010UL /* solaris 8 */ /* NYI */
244#define EVMETHOD_PORT 0x00000020 /* solaris 10 */ /* NYI */ 245#define EVBACKEND_PORT 0x00000020UL /* solaris 10 */
245
246/* flag bits */
247#define EVFLAG_NOENV 0x01000000 /* do NOT consult environment */
248 246
249#if EV_PROTOTYPES 247#if EV_PROTOTYPES
250int ev_version_major (void); 248int ev_version_major (void);
251int ev_version_minor (void); 249int ev_version_minor (void);
250
251unsigned int ev_supported_backends (void);
252unsigned int ev_recommended_backends (void);
252 253
253ev_tstamp ev_time (void); 254ev_tstamp ev_time (void);
254 255
255/* Sets the allocation function to use, works like realloc. 256/* Sets the allocation function to use, works like realloc.
256 * It is used to allocate and free memory. 257 * It is used to allocate and free memory.
267void ev_set_syserr_cb (void (*cb)(const char *msg)); 268void ev_set_syserr_cb (void (*cb)(const char *msg));
268 269
269# if EV_MULTIPLICITY 270# if EV_MULTIPLICITY
270/* the default loop is the only one that handles signals and child watchers */ 271/* the default loop is the only one that handles signals and child watchers */
271/* you can call this as often as you like */ 272/* you can call this as often as you like */
272struct ev_loop *ev_default_loop (unsigned int flags); /* returns default loop */ 273static struct ev_loop *
274ev_default_loop (unsigned int flags)
275{
276 extern struct ev_loop *ev_default_loop_ptr;
277 extern struct ev_loop *ev_default_loop_init (unsigned int flags);
278
279 if (!ev_default_loop_ptr)
280 ev_default_loop_init (flags);
281
282 return ev_default_loop_ptr;
283}
273 284
274/* create and destroy alternative loops that don't handle signals */ 285/* create and destroy alternative loops that don't handle signals */
275struct ev_loop *ev_loop_new (unsigned int flags); 286struct ev_loop *ev_loop_new (unsigned int flags);
276void ev_loop_destroy (EV_P); 287void ev_loop_destroy (EV_P);
277void ev_loop_fork (EV_P); 288void ev_loop_fork (EV_P);
296/* if you create alternative loops you have to call ev_loop_fork on them */ 307/* if you create alternative loops you have to call ev_loop_fork on them */
297/* you can call it in either the parent or the child */ 308/* you can call it in either the parent or the child */
298/* you can actually call it at any time, anywhere :) */ 309/* you can actually call it at any time, anywhere :) */
299void ev_default_fork (void); 310void ev_default_fork (void);
300 311
301unsigned int ev_method (EV_P); 312unsigned int ev_backend (EV_P);
302#endif 313#endif
303 314
304#define EVLOOP_NONBLOCK 1 /* do not block/wait */ 315#define EVLOOP_NONBLOCK 1 /* do not block/wait */
305#define EVLOOP_ONESHOT 2 /* block *once* only */ 316#define EVLOOP_ONESHOT 2 /* block *once* only */
306#define EVUNLOOP_ONCE 1 /* unloop once */ 317#define EVUNLOOP_ONE 1 /* unloop once */
307#define EVUNLOOP_ALL 2 /* unloop all loops */ 318#define EVUNLOOP_ALL 2 /* unloop all loops */
308 319
309#if EV_PROTOTYPES 320#if EV_PROTOTYPES
310void ev_loop (EV_P_ int flags); 321void ev_loop (EV_P_ int flags);
311void ev_unloop (EV_P_ int how); /* set to 1 to break out of event loop, set to 2 to break out of all event loops */ 322void ev_unloop (EV_P_ int how); /* set to 1 to break out of event loop, set to 2 to break out of all event loops */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines