develooper Front page | perl.perl5.porters | Postings from February 2003

safe signals safe test

Thread Next
From:
Jarkko Hietaniemi
Date:
February 9, 2003 04:20
Subject:
safe signals safe test
Message ID:
20030209122008.GE18527@kosh.hut.fi
Could someone provide me with sample code of where the safe signals
"reliably" gets it wrong, by e.g. never breaking when using alarm(),
or breaking out too early from an accept() loop, or breaking out too
late (only after some internal timeout *plus* the alarm() timeout),
or ...?

I already got some sample code from Matt Sergeant but unfortunately
I cannot get it to fail in any of my systems :-( (Tru64, AIX, Debian,
Solaris) while Matt says is fails on RedHat.  The code is attached,
if I understood correctly the failure is manifested by accept()
returning false and the server loop terminating because of that.

So if at all possible, if you've got failing code, *please* try to
first test in more than one platform, because otherwise other people
may have hard time getting the code to fail... network dependencies
are also bad.

Why I'm asking is that (with NI-S) we think that a reasonably backward
portable solution would be to have a magic variable, say,

	$^{SIGNAL_UNSAFE}

(by default undef) which one could localize

	local $^{SIGNAL_UNSAFE} = 1;

which would mean choosing "full speed ahead and damn the icebergs"
approach to signal handling, in other words use the old style signals
catching.  (Yes, this means that your pre-5.8.0 code would have to be
changed to add that line if you want the old behaviour. Tough.  We don't
have a time machine.)

-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

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