X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/7eebd23082204e2dce00017f483f1e876ba3079a..c4977e2742acfd90d4c4abd068f1c9e284951ef5:/ev.c?ds=inline diff --git a/ev.c b/ev.c index c6ed4b3..dedd4f3 100644 --- a/ev.c +++ b/ev.c @@ -128,7 +128,11 @@ #define PID_HASHSIZE 16 /* size of pid hash table, must be power of two */ /*#define CLEANUP_INTERVAL 300. /* how often to try to free memory and re-check fds */ -#include "ev.h" +#ifdef EV_H +# include EV_H +#else +# include "ev.h" +#endif #if __GNUC__ >= 3 # define expect(expr,value) __builtin_expect ((expr),(value)) @@ -217,19 +221,24 @@ typedef struct #if EV_MULTIPLICITY -struct ev_loop -{ -# define VAR(name,decl) decl; -# include "ev_vars.h" -}; -# undef VAR -# include "ev_wrap.h" + struct ev_loop + { + #define VAR(name,decl) decl; + #include "ev_vars.h" + #undef VAR + }; + #include "ev_wrap.h" + + struct ev_loop default_loop_struct; + static struct ev_loop *default_loop; #else -# define VAR(name,decl) static decl; -# include "ev_vars.h" -# undef VAR + #define VAR(name,decl) static decl; + #include "ev_vars.h" + #undef VAR + + static int default_loop; #endif @@ -563,6 +572,8 @@ sighandler (int signum) void ev_feed_signal_event (EV_P_ int signum) { + WL w; + #if EV_MULTIPLICITY assert (("feeding signal events is only supported in the default loop", loop == default_loop)); #endif @@ -581,7 +592,6 @@ ev_feed_signal_event (EV_P_ int signum) static void sigcb (EV_P_ struct ev_io *iow, int revents) { - WL w; int signum; #ifdef WIN32 @@ -593,7 +603,7 @@ sigcb (EV_P_ struct ev_io *iow, int revents) for (signum = signalmax; signum--; ) if (signals [signum].gotsig) - sigevent (EV_A_ signum + 1); + ev_feed_signal_event (EV_A_ signum + 1); } static void @@ -843,13 +853,8 @@ ev_loop_fork (EV_P) #endif #if EV_MULTIPLICITY -struct ev_loop default_loop_struct; -static struct ev_loop *default_loop; - struct ev_loop * #else -static int default_loop; - int #endif ev_default_loop (int methods) @@ -945,7 +950,7 @@ call_pending (EV_P) if (p->w) { p->w->pending = 0; - p->w->cb (EV_A_ p->w, p->events); + EV_CB_INVOKE (p->w, p->events); } } }