Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16544

Re: Multiprocessing: killing children when parent dies

References <CAGGWHE7b-4UvtinLW2U4jWv_uD7_nLMCQBxLjZ2rFEjsTxkZAQ@mail.gmail.com>
Date 2011-12-03 02:13 +1100
Subject Re: Multiprocessing: killing children when parent dies
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3224.1322838818.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Dec 3, 2011 at 2:05 AM, Mihai Badoiu <mbadoiu@gmail.com> wrote:
> In the multiprocessing module, on a Process p, by just doing p.daemon=1
> before p.start(), we can make the child die when the parent exits.  However,
> the child does not die if the parent gets killed.
> How can I make sure the child die when the parent gets killed?

Are you in control of the killing of the parent? One easy way would be
to catch the signal (say SIGINT) and initiate an orderly shutdown,
signalling the children first.

ChrisA

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Multiprocessing: killing children when parent dies Chris Angelico <rosuav@gmail.com> - 2011-12-03 02:13 +1100
  Re: Multiprocessing: killing children when parent dies 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 07:57 -0800
  Re: Multiprocessing: killing children when parent dies 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 07:57 -0800
    Re: Multiprocessing: killing children when parent dies Chris Angelico <rosuav@gmail.com> - 2011-12-03 03:14 +1100
      Re: Multiprocessing: killing children when parent dies 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 08:27 -0800
      Re: Multiprocessing: killing children when parent dies 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 08:27 -0800
        Re: Multiprocessing: killing children when parent dies Dan Stromberg <drsalists@gmail.com> - 2011-12-07 11:50 -0800

csiph-web