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

Comparing libev/ev.h (file contents):
Revision 1.142 by root, Thu Oct 21 14:50:58 2010 UTC vs.
Revision 1.143 by root, Fri Oct 22 05:57:55 2010 UTC

145# include <sys/types.h> 145# include <sys/types.h>
146# endif 146# endif
147# include <sys/stat.h> 147# include <sys/stat.h>
148#endif 148#endif
149 149
150#ifdef __cplusplus
151# define EV_DEFARG(x) = x
152#else
153# define EV_DEFARG(x)
154#endif
155
150/* support multiple event loops? */ 156/* support multiple event loops? */
151#if EV_MULTIPLICITY 157#if EV_MULTIPLICITY
152struct ev_loop; 158struct ev_loop;
153# define EV_P struct ev_loop *loop 159# define EV_P struct ev_loop *loop
154# define EV_P_ EV_P, 160# define EV_P_ EV_P,
192 EV_READ = 0x01, /* ev_io detected read will not block */ 198 EV_READ = 0x01, /* ev_io detected read will not block */
193 EV_WRITE = 0x02, /* ev_io detected write will not block */ 199 EV_WRITE = 0x02, /* ev_io detected write will not block */
194 EV__IOFDSET = 0x80, /* internal use only */ 200 EV__IOFDSET = 0x80, /* internal use only */
195 EV_IO = EV_READ, /* alias for type-detection */ 201 EV_IO = EV_READ, /* alias for type-detection */
196 EV_TIMER = 0x00000100, /* timer timed out */ 202 EV_TIMER = 0x00000100, /* timer timed out */
203#if EV_COMPAT3
197 EV_TIMEOUT = EV_TIMER, /* pre 4.0 API compatibility */ 204 EV_TIMEOUT = EV_TIMER, /* pre 4.0 API compatibility */
205#endif
198 EV_PERIODIC = 0x00000200, /* periodic timer timed out */ 206 EV_PERIODIC = 0x00000200, /* periodic timer timed out */
199 EV_SIGNAL = 0x00000400, /* signal was received */ 207 EV_SIGNAL = 0x00000400, /* signal was received */
200 EV_CHILD = 0x00000800, /* child/pid had status change */ 208 EV_CHILD = 0x00000800, /* child/pid had status change */
201 EV_STAT = 0x00001000, /* stat data changed */ 209 EV_STAT = 0x00001000, /* stat data changed */
202 EV_IDLE = 0x00002000, /* event loop is idling */ 210 EV_IDLE = 0x00002000, /* event loop is idling */
511} 519}
512 520
513/* the default loop is the only one that handles signals and child watchers */ 521/* the default loop is the only one that handles signals and child watchers */
514/* you can call this as often as you like */ 522/* you can call this as often as you like */
515EV_INLINE struct ev_loop * 523EV_INLINE struct ev_loop *
516ev_default_loop (unsigned int flags) 524ev_default_loop (unsigned int flags EV_DEFARG (0))
517{ 525{
518 struct ev_loop *loop = ev_default_loop_uc (); 526 struct ev_loop *loop = ev_default_loop_uc ();
519 527
520 if (!loop) 528 if (!loop)
521 { 529 {
526 534
527 return loop; 535 return loop;
528} 536}
529 537
530/* create and destroy alternative loops that don't handle signals */ 538/* create and destroy alternative loops that don't handle signals */
531struct ev_loop *ev_loop_new (unsigned int flags); 539struct ev_loop *ev_loop_new (unsigned int flags EV_DEFARG (0));
532void ev_loop_destroy (EV_P); 540void ev_loop_destroy (EV_P);
533void ev_loop_fork (EV_P); 541void ev_loop_fork (EV_P);
534 542
535ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ 543ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
536 544
537#else 545#else
538 546
539int ev_default_loop (unsigned int flags); /* returns true when successful */ 547int ev_default_loop (unsigned int flags EV_DEFARG (0)); /* returns true when successful */
540 548
541EV_INLINE ev_tstamp 549EV_INLINE ev_tstamp
542ev_now (void) 550ev_now (void)
543{ 551{
544 extern ev_tstamp ev_rt_now; 552 extern ev_tstamp ev_rt_now;
591 EVBREAK_ONE = 1, /* unloop once */ 599 EVBREAK_ONE = 1, /* unloop once */
592 EVBREAK_ALL = 2 /* unloop all loops */ 600 EVBREAK_ALL = 2 /* unloop all loops */
593}; 601};
594 602
595#if EV_PROTOTYPES 603#if EV_PROTOTYPES
596void ev_run (EV_P_ int flags); 604void ev_run (EV_P_ int flags EV_DEFARG (0));
597void ev_break (EV_P_ int how); /* set to 1 to break out of event loop, set to 2 to break out of all event loops */ 605void ev_break (EV_P_ int how EV_DEFARG (EVBREAK_ONE)); /* break out of the loop */
598 606
599/* 607/*
600 * ref/unref can be used to add or remove a refcount on the mainloop. every watcher 608 * ref/unref can be used to add or remove a refcount on the mainloop. every watcher
601 * keeps one reference. if you have a long-running watcher you never unregister that 609 * keeps one reference. if you have a long-running watcher you never unregister that
602 * should not keep ev_loop from running, unref() after starting, and ref() before stopping. 610 * should not keep ev_loop from running, unref() after starting, and ref() before stopping.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines