develooper Front page | perl.perl5.porters | Postings from August 2002

Re: Perl-5.8 signal semantics

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
August 11, 2002 04:02
Subject:
Re: Perl-5.8 signal semantics
Message ID:
20020811110200.1354.9@bactrian.ni-s.u-net.com
Michael Schroeder <Michael.Schroeder@informatik.uni-erlangen.de> writes:
>Hi Porters,
>
>a somewhat surprising change in perl-5.8 is that signal handlers
>aren't installed with SA_RESTART any longer (contradicting
>perlvar.pod). 

This is necessary for the synchronous signals stuff to work.
If the syscall is restarted the defered signal handler never gets 
called.

>This breaks some of our programs, which e.g. use:
>
>        while ($client = $server->accept()) {
>          [...]
>        }
>
>accept() is no longer restarted so the loop will fail if a signal
>occures.
>
>Another interesting point is that if one writes
>
>        while ($client = $server->accept() || $!{EINTR}) {
>          next if $!{EINTR};
>          [...]
>        }
>
>the signal handler mustn't do something that change $!, because
>then $! will not be EINTR anymore. This is a very unintuitive
>behaviour.
>
>So, what can be done? It would be nice if the syscalls that
>where automatically restarted in old perl versions would be
>handled like the ones in perlio.

The correct fix in PerlIO world is probably to have pp_accept()
test for EINTR, dispatch signals and re-start.

>
>What do you think?

Can you create a testcase?

>
>Cheers,
>  Michael.
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


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