You could use something like this:
my $exit_requested = 0; local $SIG{ INT } = sub { ++$exit_requested; }; local $SIG{ TERM } = sub { ++$exit_requested; }; while ( !$exit_requested ) { my $client_sock = $server->accept(); if ( !$client_sock ) { next if $!${ EINTR }; die( "accept: $!\n" ); } ... }
You need to be prepared to get EINTR from system calls, though.
In reply to Re: Kill a child nicely
by ikegami
in thread Kill a child nicely
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |