Ctrl-C on UNIX??

4

My question is this: Why in UNIX if I press Ctrl + C to finish the execution of a program, are there still times when I get the output of it? That is, I do not refer to situations in which the SIGINT interruption, caused by Ctrl + C, is handled by code, if not when the keys are pressed and the program does not end immediately, but after a time.

I imagine that it is due to a delay in the UNIX keyboard buffer or because the keyboard buffer is busy, but I can not really make sure or understand this effect.

I would be very grateful if you would explain it to me. Greetings!

    
asked by Anita JP 21.01.2018 в 12:46
source

1 answer

1

This happens because one of the actions to follow of this signal is:

  • The process may stop after a while, after releasing resources.

This signal is quite similar to SIGTERM that as you mentioned can be handled, ignored or captured the difference is that SIGINT can be sent by the user through ctrl + c . Then when the process receives this signal, one of the following situations can occur.

  • The process ends immediately.
  • The process may stop after a while, after releasing resources.
  • The process can continue running indefinitely.
answered by 21.01.2018 в 15:38