Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news-transit.tcx.org.uk!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:when': 0.07; 'received:209.85.160.174': 0.09; 'received:mail- gy0-f174.google.com': 0.09; 'am,': 0.12; '(say': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'module,': 0.23; 'sat,': 0.25; 'message-id:@mail.gmail.com': 0.28; 'parent': 0.30; 'does': 0.32; 'received:209.85.160': 0.33; 'to:addr:python-list': 0.34; 'received:google.com': 0.37; 'doing': 0.38; 'signal': 0.38; 'received:209.85': 0.38; 'first.': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'initiate': 0.84; 'killing': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=ylCuS5wZiJTb9ZQpVNzXC1Ttoo44HXAvrwXqMc86AB0=; b=ts0nSUyhRYnOcX/dommI8r+6biTz0U26s0zOYkQc8YvUYPx2GuewkGTbBTFyssWyrN aO58KSTLIyd9ZeeJIUiat6LClpD4Qaf4AjeUviW89yaEJYlqPqujL3ewr07QI00y/yg5 lmrPrJWGXA3+LVLQoc5/B7uuEEfPFxX6DYVRs= MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 3 Dec 2011 02:13:34 +1100 Subject: Re: Multiprocessing: killing children when parent dies From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322838818 news.xs4all.nl 6910 [2001:888:2000:d::a6]:54351 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16544 On Sat, Dec 3, 2011 at 2:05 AM, Mihai Badoiu wrote: > In the multiprocessing module, on a Process p, by just doing p.daemon=3D1 > before p.start(), we can make the child die when the parent exits. =A0How= ever, > 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