Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: python-daemon interaction with multiprocessing (secure-smtpd) Date: Wed, 7 May 2014 19:11:37 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 38 Message-ID: References: NNTP-Posting-Host: dsl.comtrol.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1399489897 8124 64.122.56.22 (7 May 2014 19:11:37 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 7 May 2014 19:11:37 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:71047 On 2014-05-07, Ben Finney wrote: > Grant Edwards writes: > >> On 2014-05-07, Grant Edwards wrote: >> > How do you terminate a Python program that's using multiprocessing? >> >> It looks like you have to kill all the threads individually. :/ > > As I understand it, the ‘multiprocessing’ module > does not > create multiple threads; it creates multiple processes. Right. I should have written processes rather than threads. > It also closely follows the API for the ‘threading’ module. That > includes the ability to manage a pool of workers >. Except when you kill the parent of a bunch of threads, they all get killed. That doesn't seem to be the case for multiprocessing. > You can ask the pool of workers to close when they're done >. > Does that address the requirement? I'm not sure. It's not really my code that's creating and managing the pool: that's happening inside the secure-smtpd module from https://github.com/bcoe/secure-smtpd. There's a little bit of wrapper code that configures the server and then starts it -- after that I don't have much control over anything. Mainly, I'm just trying to figure out the right way to terminate the server from an /etc/init script. -- Grant Edwards grant.b.edwards Yow! We're going to a at new disco! gmail.com