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

Comparing libev/ev.h (file contents):
Revision 1.112 by root, Sat Mar 28 22:17:17 2009 UTC vs.
Revision 1.116 by root, Wed Jul 8 02:46:05 2009 UTC

80 80
81#ifndef EV_ASYNC_ENABLE 81#ifndef EV_ASYNC_ENABLE
82# define EV_ASYNC_ENABLE 1 82# define EV_ASYNC_ENABLE 1
83#endif 83#endif
84 84
85#ifndef EV_WALK_ENABLE
86# define EV_WALK_ENABLE 0 /* not yet */
87#endif
88
85#ifndef EV_ATOMIC_T 89#ifndef EV_ATOMIC_T
86# include <signal.h> 90# include <signal.h>
87# define EV_ATOMIC_T sig_atomic_t volatile 91# define EV_ATOMIC_T sig_atomic_t volatile
88#endif 92#endif
89 93
145#define EV_PREPARE 0x00004000 /* event loop about to poll */ 149#define EV_PREPARE 0x00004000 /* event loop about to poll */
146#define EV_CHECK 0x00008000 /* event loop finished poll */ 150#define EV_CHECK 0x00008000 /* event loop finished poll */
147#define EV_EMBED 0x00010000 /* embedded event loop needs sweep */ 151#define EV_EMBED 0x00010000 /* embedded event loop needs sweep */
148#define EV_FORK 0x00020000 /* event loop resumed in child */ 152#define EV_FORK 0x00020000 /* event loop resumed in child */
149#define EV_ASYNC 0x00040000 /* async intra-loop signal */ 153#define EV_ASYNC 0x00040000 /* async intra-loop signal */
154#define EV_CUSTOM 0x01000000 /* for use by user code */
150#define EV_ERROR 0x80000000 /* sent when an error occurs */ 155#define EV_ERROR 0x80000000 /* sent when an error occurs */
151 156
152/* can be used to add custom fields to all watchers, while losing binary compatibility */ 157/* can be used to add custom fields to all watchers, while losing binary compatibility */
153#ifndef EV_COMMON 158#ifndef EV_COMMON
154# define EV_COMMON void *data; 159# define EV_COMMON void *data;
454 459
455/* create and destroy alternative loops that don't handle signals */ 460/* create and destroy alternative loops that don't handle signals */
456struct ev_loop *ev_loop_new (unsigned int flags); 461struct ev_loop *ev_loop_new (unsigned int flags);
457void ev_loop_destroy (EV_P); 462void ev_loop_destroy (EV_P);
458void ev_loop_fork (EV_P); 463void ev_loop_fork (EV_P);
459void ev_loop_verify (EV_P);
460 464
461ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ 465ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
462void ev_now_update (EV_P); 466void ev_now_update (EV_P);
463 467
464#else 468#else
491/* if you create alternative loops you have to call ev_loop_fork on them */ 495/* if you create alternative loops you have to call ev_loop_fork on them */
492/* you can call it in either the parent or the child */ 496/* you can call it in either the parent or the child */
493/* you can actually call it at any time, anywhere :) */ 497/* you can actually call it at any time, anywhere :) */
494void ev_default_fork (void); 498void ev_default_fork (void);
495 499
496#if 0 500unsigned int ev_backend (EV_P); /* backend in use by loop */
501unsigned int ev_loop_count (EV_P); /* number of loop iterations */
502unsigned int ev_loop_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */
503void ev_loop_verify (EV_P); /* abort if loop data corrupted */
504
505#if EV_WALK_ENABLE
497/* walk (almost) all watchers in the loop of a given type, invoking the */ 506/* walk (almost) all watchers in the loop of a given type, invoking the */
498/* callback on every such watcher. The callback might stop the watcher, */ 507/* callback on every such watcher. The callback might stop the watcher, */
499/* but do nothing else with the loop */ 508/* but do nothing else with the loop */
500void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)); 509void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w));
501#endif 510#endif
502 511
503unsigned int ev_backend (EV_P); /* backend in use by loop */
504unsigned int ev_loop_count (EV_P); /* number of loop iterations */
505#endif /* prototypes */ 512#endif /* prototypes */
506 513
507#define EVLOOP_NONBLOCK 1 /* do not block/wait */ 514#define EVLOOP_NONBLOCK 1 /* do not block/wait */
508#define EVLOOP_ONESHOT 2 /* block *once* only */ 515#define EVLOOP_ONESHOT 2 /* block *once* only */
509#define EVUNLOOP_CANCEL 0 /* undo unloop */ 516#define EVUNLOOP_CANCEL 0 /* undo unloop */
523 * should not keep ev_loop from running, unref() after starting, and ref() before stopping. 530 * should not keep ev_loop from running, unref() after starting, and ref() before stopping.
524 */ 531 */
525void ev_ref (EV_P); 532void ev_ref (EV_P);
526void ev_unref (EV_P); 533void ev_unref (EV_P);
527 534
535/*
536 * stop/start the timer handling.
537 */
538void ev_suspend (EV_P);
539void ev_resume (EV_P);
540
541/*
528/* convenience function, wait for a single event, without registering an event watcher */ 542 * convenience function, wait for a single event, without registering an event watcher
529/* if timeout is < 0, do wait indefinitely */ 543 * if timeout is < 0, do wait indefinitely
544 */
530void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg); 545void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg);
531#endif 546#endif
532 547
533/* these may evaluate ev multiple times, and the other arguments at most once */ 548/* these may evaluate ev multiple times, and the other arguments at most once */
534/* either use ev_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */ 549/* either use ev_init + ev_TYPE_set, or the ev_TYPE_init macro, below, to first initialise a watcher */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines