Re: Why is perl not honouring SIGSTOP?
by tchrist (Pilgrim) on Mar 10, 2012 at 04:54 UTC
|
^Z is (typically) bound to SIGTSTP, which is catchable, not to SIGSTOP, which isn’t. | [reply] |
|
Both SIGSTOP and SIGTSTP should STOP the process by default.
| [reply] |
|
| [reply] [d/l] |
|
| [reply] [d/l] [select] |
|
Well we are back in the circle again. Perl does not do a darn thing with these signals. Expand your test program: sleep, do something, sleep, do something, sleep, do something...
| [reply] |
Re: Why is perl not honouring SIGSTOP?
by Marshall (Canon) on Mar 10, 2012 at 04:16 UTC
|
This is an OS question, not a Perl question. What OS are you running? Perl can install signal handlers just like a C program can. Perl, like all other programs normally has nothing to do with CTL-Z. | [reply] |
|
I'm on Ubuntu .
Isn't OS supposed to STOP the process for SIGSTOP(the process is put in a TASK_STOPPED state)?
The SIGKILL and SIGSTOP signals cannot be explicitly ignored or caught, and thus their
default actions must always be executed. Therefore, SIGKILL and SIGSTOP allow a user with
appropriate privileges to destroy and to stop
seems actually not a perl question, but anyone knows the reason?
| [reply] |
|
SIGSTOP (19) - Stop process is an OS function. Perl plays (normally) no role in this. Of course it is possible to make a program do things like my text editor which interprets CTL-Z to mean "undo the last change". But basically, no Perl doesn't have anything to do with that.
| [reply] |
|
Well, I don't know but there may some strange behavior related to how Ubuntu handles sleep? If you put your Perl program into an tight loop, or have it do an blocking IO operation or have it read a big disk file line by line, I betcha CTL-Z will do something. Is this a real application question or just intellectual curiosity? Perl itself is not going to do anything with CTL-Z without a lot more code than 2 lines!
| [reply] |
Re: Why is perl not honouring SIGSTOP?
by JavaFan (Canon) on Mar 10, 2012 at 22:15 UTC
|
You're making the assumption that hitting ^-Z sends a SIGSTOP. Maybe that assumption is false. What happens if you, from another window, send a kill -19 to the program? | [reply] [d/l] |