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


Groups > comp.lang.python > #71046

Re: python-daemon interaction with multiprocessing (secure-smtpd)

From Ben Finney <ben@benfinney.id.au>
Subject Re: python-daemon interaction with multiprocessing (secure-smtpd)
Date 2014-05-08 05:01 +1000
References <lkdp2i$s9c$1@reader1.panix.com> <lkds31$dqv$1@reader1.panix.com>
Newsgroups comp.lang.python
Message-ID <mailman.9747.1399489328.18130.python-list@python.org> (permalink)

Show all headers | View raw


Grant Edwards <invalid@invalid.invalid> writes:

> On 2014-05-07, Grant Edwards <invalid@invalid.invalid> 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
<URL:https://docs.python.org/3/library/multiprocessing.html> does not
create multiple threads; it creates multiple processes.

It also closely follows the API for the ‘threading’ module. That
includes the ability to manage a pool of workers
<URL:https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool>.

You can ask the pool of workers to close when they're done
<URL:https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.close>.
Does that address the requirement?

-- 
 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\    Brain, but if we give peas a chance, won't the lima beans feel |
_o__)                                left out?” —_Pinky and The Brain_ |
Ben Finney

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


Thread

python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 17:04 +0000
  Re: python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 17:55 +0000
    Re: python-daemon interaction with multiprocessing (secure-smtpd) Ben Finney <ben@benfinney.id.au> - 2014-05-08 05:01 +1000
      Re: python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 19:11 +0000
        Re: python-daemon interaction with multiprocessing (secure-smtpd) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-05-07 21:45 +0200
  Re: python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 21:07 +0000

csiph-web