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

Comparing libev/ev.h (file contents):
Revision 1.143 by root, Fri Oct 22 05:57:55 2010 UTC vs.
Revision 1.144 by root, Fri Oct 22 06:02:27 2010 UTC

162# define EV_A_ EV_A, 162# define EV_A_ EV_A,
163# define EV_DEFAULT_UC ev_default_loop_uc () 163# define EV_DEFAULT_UC ev_default_loop_uc ()
164# define EV_DEFAULT_UC_ EV_DEFAULT_UC, 164# define EV_DEFAULT_UC_ EV_DEFAULT_UC,
165# define EV_DEFAULT ev_default_loop (0) 165# define EV_DEFAULT ev_default_loop (0)
166# define EV_DEFAULT_ EV_DEFAULT, 166# define EV_DEFAULT_ EV_DEFAULT,
167# define EV_PDEF EV_P EV_DEFARG (EV_DEFAULT_UC)
167#else 168#else
168# define EV_P void 169# define EV_P void
169# define EV_P_ 170# define EV_P_
170# define EV_A 171# define EV_A
171# define EV_A_ 172# define EV_A_
172# define EV_DEFAULT 173# define EV_DEFAULT
173# define EV_DEFAULT_ 174# define EV_DEFAULT_
174# define EV_DEFAULT_UC 175# define EV_DEFAULT_UC
175# define EV_DEFAULT_UC_ 176# define EV_DEFAULT_UC_
177# define EV_PDEF EV_P
176# undef EV_EMBED_ENABLE 178# undef EV_EMBED_ENABLE
177#endif 179#endif
178 180
179#if __STDC_VERSION__ >= 199901L || __GNUC__ >= 3 181#if __STDC_VERSION__ >= 199901L || __GNUC__ >= 3
180# define EV_INLINE static inline 182# define EV_INLINE static inline
535 return loop; 537 return loop;
536} 538}
537 539
538/* create and destroy alternative loops that don't handle signals */ 540/* create and destroy alternative loops that don't handle signals */
539struct ev_loop *ev_loop_new (unsigned int flags EV_DEFARG (0)); 541struct ev_loop *ev_loop_new (unsigned int flags EV_DEFARG (0));
540void ev_loop_destroy (EV_P); 542void ev_loop_destroy (EV_PDEF);
541void ev_loop_fork (EV_P); 543void ev_loop_fork (EV_PDEF);
542 544
543ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ 545ev_tstamp ev_now (EV_PDEF); /* time w.r.t. timers and the eventloop, updated after each poll */
544 546
545#else 547#else
546 548
547int ev_default_loop (unsigned int flags EV_DEFARG (0)); /* returns true when successful */ 549int ev_default_loop (unsigned int flags EV_DEFARG (0)); /* returns true when successful */
548 550
554 return ev_rt_now; 556 return ev_rt_now;
555} 557}
556#endif /* multiplicity */ 558#endif /* multiplicity */
557 559
558EV_INLINE int 560EV_INLINE int
559ev_is_default_loop (EV_P) 561ev_is_default_loop (EV_PDEF)
560{ 562{
561#if EV_MULTIPLICITY 563#if EV_MULTIPLICITY
562 extern struct ev_loop *ev_default_loop_ptr; 564 extern struct ev_loop *ev_default_loop_ptr;
563 565
564 return !!(EV_A == ev_default_loop_ptr); 566 return !!(EV_A == ev_default_loop_ptr);
572/* if you create alternative loops you have to call ev_loop_fork on them */ 574/* if you create alternative loops you have to call ev_loop_fork on them */
573/* you can call it in either the parent or the child */ 575/* you can call it in either the parent or the child */
574/* you can actually call it at any time, anywhere :) */ 576/* you can actually call it at any time, anywhere :) */
575void ev_default_fork (void); 577void ev_default_fork (void);
576 578
577unsigned int ev_backend (EV_P); /* backend in use by loop */ 579unsigned int ev_backend (EV_PDEF); /* backend in use by loop */
578 580
579void ev_now_update (EV_P); /* update event loop time */ 581void ev_now_update (EV_PDEF); /* update event loop time */
580 582
581#if EV_WALK_ENABLE 583#if EV_WALK_ENABLE
582/* walk (almost) all watchers in the loop of a given type, invoking the */ 584/* walk (almost) all watchers in the loop of a given type, invoking the */
583/* callback on every such watcher. The callback might stop the watcher, */ 585/* callback on every such watcher. The callback might stop the watcher, */
584/* but do nothing else with the loop */ 586/* but do nothing else with the loop */
607/* 609/*
608 * ref/unref can be used to add or remove a refcount on the mainloop. every watcher 610 * ref/unref can be used to add or remove a refcount on the mainloop. every watcher
609 * keeps one reference. if you have a long-running watcher you never unregister that 611 * keeps one reference. if you have a long-running watcher you never unregister that
610 * should not keep ev_loop from running, unref() after starting, and ref() before stopping. 612 * should not keep ev_loop from running, unref() after starting, and ref() before stopping.
611 */ 613 */
612void ev_ref (EV_P); 614void ev_ref (EV_PDEF);
613void ev_unref (EV_P); 615void ev_unref (EV_PDEF);
614 616
615/* 617/*
616 * convenience function, wait for a single event, without registering an event watcher 618 * convenience function, wait for a single event, without registering an event watcher
617 * if timeout is < 0, do wait indefinitely 619 * if timeout is < 0, do wait indefinitely
618 */ 620 */
619void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg); 621void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg);
620 622
621# if EV_FEATURE_API 623# if EV_FEATURE_API
622unsigned int ev_iteration (EV_P); /* number of loop iterations */ 624unsigned int ev_iteration (EV_PDEF); /* number of loop iterations */
623unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */ 625unsigned int ev_depth (EV_PDEF); /* #ev_loop enters - #ev_loop leaves */
624void ev_verify (EV_P); /* abort if loop data corrupted */ 626void ev_verify (EV_PDEF); /* abort if loop data corrupted */
625 627
626void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ 628void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
627void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ 629void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */
628 630
629/* advanced stuff for threading etc. support, see docs */ 631/* advanced stuff for threading etc. support, see docs */
630void ev_set_userdata (EV_P_ void *data); 632void ev_set_userdata (EV_P_ void *data);
631void *ev_userdata (EV_P); 633void *ev_userdata (EV_PDEF);
632void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P)); 634void ev_set_invoke_pending_cb (EV_P_ void (*invoke_pending_cb)(EV_P));
633void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P)); 635void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P));
634 636
635unsigned int ev_pending_count (EV_P); /* number of pending events, if any */ 637unsigned int ev_pending_count (EV_PDEF); /* number of pending events, if any */
636void ev_invoke_pending (EV_P); /* invoke all pending watchers */ 638void ev_invoke_pending (EV_PDEF); /* invoke all pending watchers */
637 639
638/* 640/*
639 * stop/start the timer handling. 641 * stop/start the timer handling.
640 */ 642 */
641void ev_suspend (EV_P); 643void ev_suspend (EV_PDEF);
642void ev_resume (EV_P); 644void ev_resume (EV_PDEF);
643#endif 645#endif
644 646
645#endif 647#endif
646 648
647/* these may evaluate ev multiple times, and the other arguments at most once */ 649/* these may evaluate ev multiple times, and the other arguments at most once */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines