On 21Mar2015 09:19, Peter Otten <[email protected]> wrote:
I ran a few experiments:
[...]
Bonus:
$ python3 bnb.py SIGTSTP
Hello from 32614
........^Zreceiving signal 20 (20, <frame object at 0x7f2f8a897648>)
........^Cfinally
except (<class 'KeyboardInterrupt'>, KeyboardInterrupt(), <traceback object
at 0x7f2f895a2bc8>)
exit

So Ctrl-Z can be intercepted. The program could put the relay into a safe
state before it suspends.

Yes, Ctrl-Z (SIGTSTP) can be caught ("stop from terminal", ^Z).
Note, however, that SIGSTOP cannot be caught ("stop"); it is not SIGTSTP.

Basicly you can kill (SIGKILL - abort process and never schedule it again), stop (SIGSTOP - cease scheduling this process) and continue (SIGCONT - resume scheduling this process) a process from outside a process and the process cannot intercept these. Which is just great! However, it means there are some things you cannot manage from within the process. This is where watchdogs of various kinds come into play: an external process of some kind which monitors the primary process (or something it manages), and take action if the primary process goes away or some activity does not occur for a period.

Cheers,
Cameron Simpson <[email protected]>

Cordless hoses have been around for quite some time. They're called buckets.
       - Dan Prener <[email protected]>
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to