On Feb 22, 2007, at 01:52, Michael Collins wrote:

I am searching for a way to catch and handle a Control-C when using
multiple POE sessions. I have successfully used the snippet from the POE
Cookbook to actually catch the INT signal in each of my Sessions:

event_sigint => sub {

  my ($kernel, $session) = @_[KERNEL, SESSION];

  print STDERR "Caught Control-C, shutting down gracefully.\ +n";

  $kernel->yield("Shutdown",2,'Received break from user');

}, # event_sigint

In all but one of my sessions I simply catch the signal and print to
STDERR a simple message giving the session alias. The above snippet is
in only one of my sessions and I want to use it to do the graceful
shutdown.

After reading this a second time, it occurs to me that you aren't calling $kernel->sig_handled() in your SIGINT handler. If no session does, then POE will not know you've handled the signal. It'll continue on to reap your sessions prematurely.

--
Rocco Caputo - [EMAIL PROTECTED]


Reply via email to