18

Been working for a while with some terrible code with no documentation that I just inherited from a previous employee

Topic: multi-threaded program in Python

Goal: kill both parent and children with keyboard interrupt

Intuitive idea: check in children processes if parent still alive

Implemented idea:
- parent creates socket connection
- keyboard interrupt kills parent and thus the socket connection as well
- children receive some specific socket error from the loss of connection
- children catch the exception and are killed
In Python 2, of course

I, too, like to inflict pain on myself for fun

Comments
Add Comment