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

Comparing libev/ev.h (file contents):
Revision 1.86 by root, Thu Dec 20 07:12:57 2007 UTC vs.
Revision 1.88 by root, Sat Dec 22 05:48:00 2007 UTC

118#endif 118#endif
119#ifndef EV_PROTOTYPES 119#ifndef EV_PROTOTYPES
120# define EV_PROTOTYPES 1 120# define EV_PROTOTYPES 1
121#endif 121#endif
122 122
123#define EV_VERSION_MAJOR 1 123#define EV_VERSION_MAJOR 2
124#define EV_VERSION_MINOR 0 124#define EV_VERSION_MINOR 0
125 125
126#ifndef EV_CB_DECLARE 126#ifndef EV_CB_DECLARE
127# define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents); 127# define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents);
128#endif 128#endif
283/* the callback gets invoked when the event loop has handled events, and can be 0 */ 283/* the callback gets invoked when the event loop has handled events, and can be 0 */
284typedef struct ev_embed 284typedef struct ev_embed
285{ 285{
286 EV_WATCHER (ev_embed) 286 EV_WATCHER (ev_embed)
287 287
288 ev_io io; /* private */
289 struct ev_loop *other; /* ro */ 288 struct ev_loop *other; /* ro */
289 ev_io io; /* private */
290 ev_prepare prepare; /* private */
291 ev_check check; /* unused */
292 ev_timer timer; /* unused */
293 ev_periodic periodic; /* unused */
294 ev_idle idle; /* unused */
295 ev_fork fork; /* unused */
290} ev_embed; 296} ev_embed;
291#endif 297#endif
292 298
293/* the presence of this union forces similar struct layout */ 299/* the presence of this union forces similar struct layout */
294union ev_any_watcher 300union ev_any_watcher
338unsigned int ev_supported_backends (void); 344unsigned int ev_supported_backends (void);
339unsigned int ev_recommended_backends (void); 345unsigned int ev_recommended_backends (void);
340unsigned int ev_embeddable_backends (void); 346unsigned int ev_embeddable_backends (void);
341 347
342ev_tstamp ev_time (void); 348ev_tstamp ev_time (void);
349void ev_sleep (ev_tstamp delay); /* sleep for a while */
343 350
344/* Sets the allocation function to use, works like realloc. 351/* Sets the allocation function to use, works like realloc.
345 * It is used to allocate and free memory. 352 * It is used to allocate and free memory.
346 * If it returns zero when memory needs to be allocated, the library might abort 353 * If it returns zero when memory needs to be allocated, the library might abort
347 * or take some potentially destructive action. 354 * or take some potentially destructive action.
395/* if you create alternative loops you have to call ev_loop_fork on them */ 402/* if you create alternative loops you have to call ev_loop_fork on them */
396/* you can call it in either the parent or the child */ 403/* you can call it in either the parent or the child */
397/* you can actually call it at any time, anywhere :) */ 404/* you can actually call it at any time, anywhere :) */
398void ev_default_fork (void); 405void ev_default_fork (void);
399 406
400unsigned int ev_backend (EV_P); 407unsigned int ev_backend (EV_P); /* backend in use by loop */
401unsigned int ev_loop_count (EV_P); 408unsigned int ev_loop_count (EV_P); /* number of loop iterations */
402#endif 409#endif
403 410
404#define EVLOOP_NONBLOCK 1 /* do not block/wait */ 411#define EVLOOP_NONBLOCK 1 /* do not block/wait */
405#define EVLOOP_ONESHOT 2 /* block *once* only */ 412#define EVLOOP_ONESHOT 2 /* block *once* only */
406#define EVUNLOOP_CANCEL 0 /* undo unloop */ 413#define EVUNLOOP_CANCEL 0 /* undo unloop */
408#define EVUNLOOP_ALL 2 /* unloop all loops */ 415#define EVUNLOOP_ALL 2 /* unloop all loops */
409 416
410#if EV_PROTOTYPES 417#if EV_PROTOTYPES
411void ev_loop (EV_P_ int flags); 418void ev_loop (EV_P_ int flags);
412void 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 */ 419void 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 */
420
421void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
422void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
413 423
414/* 424/*
415 * ref/unref can be used to add or remove a refcount on the mainloop. every watcher 425 * ref/unref can be used to add or remove a refcount on the mainloop. every watcher
416 * keeps one reference. if you have a long-runing watcher you never unregister that 426 * keeps one reference. if you have a long-runing watcher you never unregister that
417 * should not keep ev_loop from running, unref() after starting, and ref() before stopping. 427 * should not keep ev_loop from running, unref() after starting, and ref() before stopping.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines