From: Jarkko Hietaniemi Date: Tue, 25 Feb 2003 06:01:09 +0000 (+0000) Subject: A new try at #18765 (for [perl #20920]). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=25da442874cf6136cfd7e0a24430b1ec13c17197;p=p5sagit%2Fp5-mst-13.2.git A new try at #18765 (for [perl #20920]). p4raw-id: //depot/perl@18770 --- diff --git a/mg.c b/mg.c index da5666c..116a369 100644 --- a/mg.c +++ b/mg.c @@ -1158,8 +1158,26 @@ Perl_despatch_signals(pTHX) PL_sig_pending = 0; for (sig = 1; sig < SIG_SIZE; sig++) { if (PL_psig_pend[sig]) { - PL_psig_pend[sig] = 0; +#define PERL_BLOCK_SIGNALS +#if defined(HAS_SIGPROCMASK) && defined(PERL_BLOCK_SIGNALS) + /* From sigaction(2) (FreeBSD man page): + * | Signal routines normally execute with the signal that + * | caused their invocation blocked, but other signals may + * | yet occur. + * Emulate this behavior. + */ +# define PERL_BLOCKSIG_ADD(set,sig) \ + sigset_t set; sigemptyset(&(set)); sigaddset(&(set), sig) +# define PERL_BLOCKSIG_BLOCK(set) \ + sigprocmask(SIG_BLOCK, &(set), NULL) +# define PERL_BLOCKSIG_UNBLOCK(set) \ + sigprocmask(SIG_UNBLOCK, &(set), NULL) +#endif /* HAS_SIGPROCMASK && PERL_BLOCK_SIGNALS */ + PERL_BLOCKSIG_ADD(set, sig); + PL_psig_pend[sig] = 0; + PERL_BLOCKSIG_BLOCK(set); (*PL_sighandlerp)(sig); + PERL_BLOCKSIG_UNBLOCK(set); } } }