… | |
… | |
156 | struct ev_loop; |
156 | struct ev_loop; |
157 | # define EV_P struct ev_loop *loop /* a loop as sole parameter in a declaration */ |
157 | # define EV_P struct ev_loop *loop /* a loop as sole parameter in a declaration */ |
158 | # define EV_P_ EV_P, /* a loop as first of multiple parameters */ |
158 | # define EV_P_ EV_P, /* a loop as first of multiple parameters */ |
159 | # define EV_A loop /* a loop as sole argument to a function call */ |
159 | # define EV_A loop /* a loop as sole argument to a function call */ |
160 | # define EV_A_ EV_A, /* a loop as first of multiple arguments */ |
160 | # define EV_A_ EV_A, /* a loop as first of multiple arguments */ |
161 | # define EV_DEFAULT_UC ev_default_loop_uc () /* the default loop, if initialised, as sole arg */ |
161 | # define EV_DEFAULT_UC ev_default_loop_uc_ () /* the default loop, if initialised, as sole arg */ |
162 | # define EV_DEFAULT_UC_ EV_DEFAULT_UC, /* the default loop as first of multiple arguments */ |
162 | # define EV_DEFAULT_UC_ EV_DEFAULT_UC, /* the default loop as first of multiple arguments */ |
163 | # define EV_DEFAULT ev_default_loop (0) /* the default loop as sole arg */ |
163 | # define EV_DEFAULT ev_default_loop (0) /* the default loop as sole arg */ |
164 | # define EV_DEFAULT_ EV_DEFAULT, /* the default loop as first of multiple arguments */ |
164 | # define EV_DEFAULT_ EV_DEFAULT, /* the default loop as first of multiple arguments */ |
165 | #else |
165 | #else |
166 | # define EV_P void |
166 | # define EV_P void |
… | |
… | |
514 | /* the default loop is the only one that handles signals and child watchers */ |
514 | /* the default loop is the only one that handles signals and child watchers */ |
515 | /* you can call this as often as you like */ |
515 | /* you can call this as often as you like */ |
516 | struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0)); |
516 | struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0)); |
517 | |
517 | |
518 | EV_INLINE struct ev_loop * |
518 | EV_INLINE struct ev_loop * |
519 | ev_default_loop_uc (void) |
519 | ev_default_loop_uc_ (void) |
520 | { |
520 | { |
521 | extern struct ev_loop *ev_default_loop_ptr; |
521 | extern struct ev_loop *ev_default_loop_ptr; |
522 | |
522 | |
523 | return ev_default_loop_ptr; |
523 | return ev_default_loop_ptr; |
524 | } |
524 | } |
525 | |
525 | |
526 | EV_INLINE int |
526 | EV_INLINE int |
527 | ev_is_default_loop (EV_P) |
527 | ev_is_default_loop (EV_P) |
528 | { |
528 | { |
529 | return EV_A == ev_default_loop_uc (); |
529 | return EV_A == EV_DEFAULT_UC; |
530 | } |
530 | } |
531 | |
531 | |
532 | /* create and destroy alternative loops that don't handle signals */ |
532 | /* create and destroy alternative loops that don't handle signals */ |
533 | struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)); |
533 | struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)); |
|
|
534 | /* destroy event loops, also works for the default loop */ |
534 | void ev_loop_destroy (EV_P); |
535 | void ev_loop_destroy (EV_P); |
535 | void ev_loop_fork (EV_P); |
|
|
536 | |
536 | |
537 | ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ |
537 | ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ |
538 | |
538 | |
539 | #else |
539 | #else |
540 | |
540 | |
… | |
… | |
555 | return 1; |
555 | return 1; |
556 | } |
556 | } |
557 | |
557 | |
558 | #endif /* multiplicity */ |
558 | #endif /* multiplicity */ |
559 | |
559 | |
560 | void ev_default_destroy (void); /* destroy the default loop */ |
|
|
561 | /* this needs to be called after fork, to duplicate the default loop */ |
560 | /* this needs to be called after fork, to duplicate the loop */ |
562 | /* if you create alternative loops you have to call ev_loop_fork on them */ |
561 | /* when you want to re-use it in the child */ |
563 | /* you can call it in either the parent or the child */ |
562 | /* you can call it in either the parent or the child */ |
564 | /* you can actually call it at any time, anywhere :) */ |
563 | /* you can actually call it at any time, anywhere :) */ |
565 | void ev_default_fork (void); |
564 | void ev_loop_fork (EV_P); |
566 | |
565 | |
567 | unsigned int ev_backend (EV_P); /* backend in use by loop */ |
566 | unsigned int ev_backend (EV_P); /* backend in use by loop */ |
568 | |
567 | |
569 | void ev_now_update (EV_P); /* update event loop time */ |
568 | void ev_now_update (EV_P); /* update event loop time */ |
570 | |
569 | |
… | |
… | |
776 | #define EVUNLOOP_ONE EVBREAK_ONE |
775 | #define EVUNLOOP_ONE EVBREAK_ONE |
777 | #define EVUNLOOP_ALL EVBREAK_ALL |
776 | #define EVUNLOOP_ALL EVBREAK_ALL |
778 | #if EV_PROTOTYPES |
777 | #if EV_PROTOTYPES |
779 | EV_INLINE void ev_loop (EV_P_ int flags) { ev_run (EV_A_ flags); } |
778 | EV_INLINE void ev_loop (EV_P_ int flags) { ev_run (EV_A_ flags); } |
780 | EV_INLINE void ev_unloop (EV_P_ int how ) { ev_break (EV_A_ how ); } |
779 | EV_INLINE void ev_unloop (EV_P_ int how ) { ev_break (EV_A_ how ); } |
|
|
780 | EV_INLINE void ev_default_destroy (void) { ev_loop_destroy (EV_DEFAULT); } |
|
|
781 | EV_INLINE void ev_default_fork (void) { ev_loop_fork (EV_DEFAULT); } |
781 | #if EV_FEATURE_API |
782 | #if EV_FEATURE_API |
782 | EV_INLINE void ev_loop_count (EV_P) { ev_iteration (EV_A); } |
783 | EV_INLINE void ev_loop_count (EV_P) { ev_iteration (EV_A); } |
783 | EV_INLINE void ev_loop_depth (EV_P) { ev_depth (EV_A); } |
784 | EV_INLINE void ev_loop_depth (EV_P) { ev_depth (EV_A); } |
784 | EV_INLINE void ev_loop_verify (EV_P) { ev_verify (EV_A); } |
785 | EV_INLINE void ev_loop_verify (EV_P) { ev_verify (EV_A); } |
785 | #endif |
786 | #endif |