From fdf8e637ed5779a72783db49d403f4f8b2e76de0 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 10 Jan 2011 01:58:54 +0000 Subject: *** empty log message *** --- ev.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'ev.c') diff --git a/ev.c b/ev.c index 512e15d..c7e5077 100644 --- a/ev.c +++ b/ev.c @@ -1,7 +1,7 @@ /* * libev event processing core, watcher management * - * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann + * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- @@ -1371,19 +1371,28 @@ pipecb (EV_P_ ev_io *iow, int revents) /*****************************************************************************/ -static void -ev_sighandler (int signum) +void +ev_feed_signal (int signum) { #if EV_MULTIPLICITY EV_P = signals [signum - 1].loop; + + if (!EV_A) + return; #endif + signals [signum - 1].pending = 1; + evpipe_write (EV_A_ &sig_pending); +} + +static void +ev_sighandler (int signum) +{ #ifdef _WIN32 signal (signum, ev_sighandler); #endif - signals [signum - 1].pending = 1; - evpipe_write (EV_A_ &sig_pending); + ev_feed_signal (signum); } void noinline @@ -1645,6 +1654,8 @@ loop_init (EV_P_ unsigned int flags) { if (!backend) { + origflags = flags; + #if EV_USE_REALTIME if (!have_realtime) { @@ -1699,7 +1710,7 @@ loop_init (EV_P_ unsigned int flags) sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1; #endif - if (!(flags & 0x0000ffffU)) + if (!(flags & EVBACKEND_MASK)) flags |= ev_recommended_backends (); #if EV_USE_IOCP @@ -2881,9 +2892,12 @@ ev_signal_start (EV_P_ ev_signal *w) sa.sa_flags = SA_RESTART; /* if restarting works we save one iteration */ sigaction (w->signum, &sa, 0); - sigemptyset (&sa.sa_mask); - sigaddset (&sa.sa_mask, w->signum); - sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0); + if (origflags & EVFLAG_NOSIGMASK) + { + sigemptyset (&sa.sa_mask); + sigaddset (&sa.sa_mask, w->signum); + sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0); + } #endif } -- cgit v1.2.3