in reply to Re^2: Interrupt Handling - What am I doing wrong?
in thread Interrupt Handling - What am I doing wrong?

Do you really not get "Waiting for critical tasks to finish before terminating program"? That would mean your signal handler isn't called at all.

Either way, I already gave a reason the current code won't always work. Executing the signal handler will prevent (at least) that thread from doing anything else. If the signal handler is called from a thread1 thread, that thread1 thread won't be able to progress.

  • Comment on Re^3: Interrupt Handling - What am I doing wrong?

Replies are listed 'Best First'.
Re^4: Interrupt Handling - What am I doing wrong?
by vishi (Beadle) on Apr 26, 2011 at 05:56 UTC

    Oh.. I do get the message. Its just that it's not being displayed right away..as soon as I press Ctrl C. The message is suppressed till the thread completes the "join". As soon as it joins, the message is displayed. Somehow, the join is blocking - not sure why.

    If I remove threads, and just use the normal expect.pm module..spawn a remote session ... do my work and press Ctrl C....the message appears immediately. What is it in the threads that is causing this behaviour?

      Signals are only checked between Perl ops.