in reply to Re: the unsafe signals controversy
in thread the unsafe signals controversy

Uhm, how would you use that? Signal the external program, which then signals the Perl program? That doesn't seem to gain anything, does it?

The jist of it:

Fork, execute operation in new process p2 which will update a file or some shared ipc on completion. P1 has a signal handler that will notify 'p1' if it was interrupted in a 'safe' area.

In p1, use the alarm signal to 'timeout' p2. If update was not performed yet, send a SIGTERM (followed by a SIGKILL if necessary).try again.

it is a kludge and not 100% full proof, but works ok in all the tests I've performed so far.