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:
Raphael_Manfredi
Date:
January 9, 2001 05:34
Subject:
Re: Does perl really need to use sigsetjmp? (18% performance hit)
Message ID:
93f159$6mg$1@lyon.ram.loc
[courtesy cc of this posting sent to cited author via email]

Quoting Alan Burlison <Alan.Burlison@uk.sun.com> from ml.lang.perl.porters:
:My vote is for us to revert back to setjmp, and as I indicated I may
:well just disable it regardless when I integrate 5.6.1 into Solaris.

The problem is to know the semantics we wish to guarantee when one
does this:

	$SIG{ALRM} = 'IGNORE';

	eval { &foo };
	print "back from foo()\n";
	alarm(2);
	select(undef, undef, undef, 4);

	sub TIMEOUT {
		die "TIMEOUT";
	}

	sub foo {
		$SIG{ALRM} = 'TIMEOUT';
		alarm(2);
		select(undef, undef, undef, 4);
	}

For me (Linux 2.4.0, perl 5.005_03), it yields:

	back from foo()
	TIMEOUT at /home/ram/tmp/alarm line 9

Is this what is expected?

I wonder where sigsetjmp() comes into play here, because what is
happening shows that the signal mask is not restored, and that ALRM
continues to be trapped even though we came back through a siglongjmp()?

Raphael

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