… | |
… | |
102 | #ifndef EV_FORK_ENABLE |
102 | #ifndef EV_FORK_ENABLE |
103 | # define EV_FORK_ENABLE EV_FEATURE_WATCHERS |
103 | # define EV_FORK_ENABLE EV_FEATURE_WATCHERS |
104 | #endif |
104 | #endif |
105 | |
105 | |
106 | #ifndef EV_CLEANUP_ENABLE |
106 | #ifndef EV_CLEANUP_ENABLE |
107 | # define EV_CLEANUP_ENABLE 0 /* not implemented */ |
107 | # define EV_CLEANUP_ENABLE EV_FEATURE_WATCHERS |
108 | #endif |
108 | #endif |
109 | |
109 | |
110 | #ifndef EV_SIGNAL_ENABLE |
110 | #ifndef EV_SIGNAL_ENABLE |
111 | # define EV_SIGNAL_ENABLE EV_FEATURE_WATCHERS |
111 | # define EV_SIGNAL_ENABLE EV_FEATURE_WATCHERS |
112 | #endif |
112 | #endif |
… | |
… | |
191 | #endif |
191 | #endif |
192 | |
192 | |
193 | /*****************************************************************************/ |
193 | /*****************************************************************************/ |
194 | |
194 | |
195 | #define EV_VERSION_MAJOR 4 |
195 | #define EV_VERSION_MAJOR 4 |
196 | #define EV_VERSION_MINOR 0 |
196 | #define EV_VERSION_MINOR 1 |
197 | |
197 | |
198 | /* eventmask, revents, events... */ |
198 | /* eventmask, revents, events... */ |
199 | enum { |
199 | enum { |
200 | EV_UNDEF = -1, /* guaranteed to be invalid */ |
200 | EV_UNDEF = 0xFFFFFFFF, /* guaranteed to be invalid */ |
201 | EV_NONE = 0x00, /* no events */ |
201 | EV_NONE = 0x00, /* no events */ |
202 | EV_READ = 0x01, /* ev_io detected read will not block */ |
202 | EV_READ = 0x01, /* ev_io detected read will not block */ |
203 | EV_WRITE = 0x02, /* ev_io detected write will not block */ |
203 | EV_WRITE = 0x02, /* ev_io detected write will not block */ |
204 | EV__IOFDSET = 0x80, /* internal use only */ |
204 | EV__IOFDSET = 0x80, /* internal use only */ |
205 | EV_IO = EV_READ, /* alias for type-detection */ |
205 | EV_IO = EV_READ, /* alias for type-detection */ |
… | |
… | |
550 | return EV_A == EV_DEFAULT_UC; |
550 | return EV_A == EV_DEFAULT_UC; |
551 | } |
551 | } |
552 | |
552 | |
553 | /* create and destroy alternative loops that don't handle signals */ |
553 | /* create and destroy alternative loops that don't handle signals */ |
554 | struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)); |
554 | struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)); |
555 | /* destroy event loops, also works for the default loop */ |
|
|
556 | void ev_loop_destroy (EV_P); |
|
|
557 | |
555 | |
558 | ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ |
556 | ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ |
559 | |
557 | |
560 | #else |
558 | #else |
561 | |
559 | |
… | |
… | |
575 | { |
573 | { |
576 | return 1; |
574 | return 1; |
577 | } |
575 | } |
578 | |
576 | |
579 | #endif /* multiplicity */ |
577 | #endif /* multiplicity */ |
|
|
578 | |
|
|
579 | /* destroy event loops, also works for the default loop */ |
|
|
580 | void ev_loop_destroy (EV_P); |
580 | |
581 | |
581 | /* this needs to be called after fork, to duplicate the loop */ |
582 | /* this needs to be called after fork, to duplicate the loop */ |
582 | /* when you want to re-use it in the child */ |
583 | /* when you want to re-use it in the child */ |
583 | /* you can call it in either the parent or the child */ |
584 | /* you can call it in either the parent or the child */ |
584 | /* you can actually call it at any time, anywhere :) */ |
585 | /* you can actually call it at any time, anywhere :) */ |
… | |
… | |
806 | EV_INLINE void ev_loop (EV_P_ int flags) { ev_run (EV_A_ flags); } |
807 | EV_INLINE void ev_loop (EV_P_ int flags) { ev_run (EV_A_ flags); } |
807 | EV_INLINE void ev_unloop (EV_P_ int how ) { ev_break (EV_A_ how ); } |
808 | EV_INLINE void ev_unloop (EV_P_ int how ) { ev_break (EV_A_ how ); } |
808 | EV_INLINE void ev_default_destroy (void) { ev_loop_destroy (EV_DEFAULT); } |
809 | EV_INLINE void ev_default_destroy (void) { ev_loop_destroy (EV_DEFAULT); } |
809 | EV_INLINE void ev_default_fork (void) { ev_loop_fork (EV_DEFAULT); } |
810 | EV_INLINE void ev_default_fork (void) { ev_loop_fork (EV_DEFAULT); } |
810 | #if EV_FEATURE_API |
811 | #if EV_FEATURE_API |
811 | EV_INLINE void ev_loop_count (EV_P) { ev_iteration (EV_A); } |
812 | EV_INLINE unsigned int ev_loop_count (EV_P) { return ev_iteration (EV_A); } |
812 | EV_INLINE void ev_loop_depth (EV_P) { ev_depth (EV_A); } |
813 | EV_INLINE unsigned int ev_loop_depth (EV_P) { return ev_depth (EV_A); } |
813 | EV_INLINE void ev_loop_verify (EV_P) { ev_verify (EV_A); } |
814 | EV_INLINE void ev_loop_verify (EV_P) { ev_verify (EV_A); } |
814 | #endif |
815 | #endif |
815 | #endif |
816 | #endif |
816 | #else |
817 | #else |
817 | typedef struct ev_loop ev_loop; |
818 | typedef struct ev_loop ev_loop; |
818 | #endif |
819 | #endif |