From 091617c5e9d95bebfbb7f57fa1faeb22fcb57feb Mon Sep 17 00:00:00 2001 From: root Date: Tue, 19 Feb 2008 17:09:28 +0000 Subject: *** empty log message *** --- ev.c | 5 ++++- ev.h | 12 ++++++++++++ ev.pod | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ev.c b/ev.c index a780297..fada483 100644 --- a/ev.c +++ b/ev.c @@ -813,6 +813,9 @@ evpipe_init (EV_P) ev_io_set (&pipeev, evpipe [0], EV_READ); ev_io_start (EV_A_ &pipeev); ev_unref (EV_A); /* watcher should not keep loop alive */ + + /* in case we received the signal before we had the chance of installing a handler */ + ev_feed_event (EV_A_ &pipeev, 0); } } @@ -840,7 +843,7 @@ pipecb (EV_P_ ev_io *iow, int revents) read (evpipe [0], &dummy, 1); } - if (gotsig) + if (gotsig && ev_is_default_loop (EV_A)) { int signum; gotsig = 0; diff --git a/ev.h b/ev.h index 50bd57e..5a3d152 100644 --- a/ev.h +++ b/ev.h @@ -432,6 +432,18 @@ ev_now (void) } # endif +static int +ev_is_default_loop (EV_P) +{ +#if EV_MULTIPLICITY + extern struct ev_loop *ev_default_loop_ptr; + + return !!(EV_A == ev_default_loop_ptr); +#else + return 1; +#endif +} + void ev_default_destroy (void); /* destroy the default loop */ /* this needs to be called after fork, to duplicate the default loop */ /* if you create alternative loops you have to call ev_loop_fork on them */ diff --git a/ev.pod b/ev.pod index f9d11df..f2acd4f 100644 --- a/ev.pod +++ b/ev.pod @@ -508,6 +508,10 @@ Like C, but acts on an event loop created by C. Yes, you have to call this on every allocated event loop after fork, and how you do this is entirely your own problem. +=item int ev_is_default_loop (loop) + +Returns true when the given loop actually is the default loop, false otherwise. + =item unsigned int ev_loop_count (loop) Returns the count of loop iterations for the loop, which is identical to -- cgit v1.2.3