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

Comparing libev/ev.h (file contents):
Revision 1.147 by root, Fri Oct 22 09:24:11 2010 UTC vs.
Revision 1.148 by root, Sun Oct 24 14:44:40 2010 UTC

508 * (such as failed select, poll, epoll_wait) 508 * (such as failed select, poll, epoll_wait)
509 */ 509 */
510void ev_set_syserr_cb (void (*cb)(const char *msg)); 510void ev_set_syserr_cb (void (*cb)(const char *msg));
511 511
512#if EV_MULTIPLICITY 512#if EV_MULTIPLICITY
513
514/* the default loop is the only one that handles signals and child watchers */
515/* you can call this as often as you like */
516struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0));
517
513EV_INLINE struct ev_loop * 518EV_INLINE struct ev_loop *
514ev_default_loop_uc (void) 519ev_default_loop_uc (void)
515{ 520{
516 extern struct ev_loop *ev_default_loop_ptr; 521 extern struct ev_loop *ev_default_loop_ptr;
517 522
518 return ev_default_loop_ptr; 523 return ev_default_loop_ptr;
519} 524}
520 525
521/* the default loop is the only one that handles signals and child watchers */ 526EV_INLINE int
522/* you can call this as often as you like */ 527ev_is_default_loop (EV_P)
523EV_INLINE struct ev_loop *
524ev_default_loop (unsigned int flags EV_CPP (= 0))
525{ 528{
526 struct ev_loop *loop = ev_default_loop_uc (); 529 return EV_A == ev_default_loop_uc ();
527
528 if (!loop)
529 {
530 extern struct ev_loop *ev_default_loop_init (unsigned int flags);
531
532 loop = ev_default_loop_init (flags);
533 }
534
535 return loop;
536} 530}
537 531
538/* create and destroy alternative loops that don't handle signals */ 532/* create and destroy alternative loops that don't handle signals */
539struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)); 533struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0));
540void ev_loop_destroy (EV_P); 534void ev_loop_destroy (EV_P);
551{ 545{
552 extern ev_tstamp ev_rt_now; 546 extern ev_tstamp ev_rt_now;
553 547
554 return ev_rt_now; 548 return ev_rt_now;
555} 549}
550
551/* looks weird, but ev_is_default_loop (EV_A) still works if this exists */
552EV_INLINE int
553ev_is_default_loop (void)
554{
555 return 1;
556}
557
556#endif /* multiplicity */ 558#endif /* multiplicity */
557
558EV_INLINE int
559ev_is_default_loop (EV_P)
560{
561#if EV_MULTIPLICITY
562 extern struct ev_loop *ev_default_loop_ptr;
563
564 return !!(EV_A == ev_default_loop_ptr);
565#else
566 return 1;
567#endif
568}
569 559
570void ev_default_destroy (void); /* destroy the default loop */ 560void ev_default_destroy (void); /* destroy the default loop */
571/* this needs to be called after fork, to duplicate the default loop */ 561/* this needs to be called after fork, to duplicate the default loop */
572/* if you create alternative loops you have to call ev_loop_fork on them */ 562/* 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 */ 563/* you can call it in either the parent or the child */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines