develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Does perl really need to use sigsetjmp? (18% performance hit)

Thread Previous | Thread Next
From:
Tim Bunce
Date:
January 10, 2001 03:04
Subject:
Re: Does perl really need to use sigsetjmp? (18% performance hit)
Message ID:
20010110104844.H17059@ig.co.uk
On Tue, Jan 09, 2001 at 05:15:35PM +0000, Nick Ing-Simmons wrote:
> Alan Burlison <Alan.Burlison@uk.sun.com> writes:
> >Nick Ing-Simmons wrote:
> >
> >> Apparently not. I cannot at present think what sigsetjmp() gains
> >> us. Do you have an guidelines which say "use sigsetjmp() if your code does X?"
> >
> >In perl terms, I think the only time this would happen is if you did a
> >die inside a signal handler, and expected to go back to an enclosing
> >eval() with the signal handler restored.  
> 
> I am sure we could do something special round perl signal handlers
> and leave the vast bulk of other eval {} / G_EVAL code using 
> normal setjmp().
> 
> Unless there is a more obvious/portable mechanism to save/restore the
> mask then something like:
> 
> void 
> invoke_handler(...)
> {
>  code = sigsetjmp(...);
>  if (!code)
>   {
>    perl_call_xxx(...,G_EVAL|G_VOID);
>    if (SvTRUE(PL_errsv))
>     siglongjmp(...,1);
>   }
> }
> 
> should do it.

I like that approach.

I'd be nervous of just switching from the sig functions to non-sig globally.

Tim.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About