[Python-ideas] An error in multiprocessing on MacOSX?
Richard Oudkerk
shibturn at gmail.com
Wed Nov 21 23:18:31 CET 2012
On 21/11/2012 8:29pm, Gregory P. Smith wrote:
> I don't care how this is read or what the default behavior is. All I
> want is for someone who cares about multiprocessing actually working
> well for people to implement optional support for *not* using os.fork()
> on posixish systems. ie: port an equivalent of the windows stuff over.
>
> I don't use multiprocessing so I've never looked into adding it. It
> shouldn't be difficult given the legwork has already been done for use
> on windows. this is exactly what issue8713 is asking for.
An implementation is available at
http://hg.python.org/sandbox/sbt#spawn
You just need to stick
multiprocessing.set_start_method('spawn')
at the beginning of the program to use fork+exec instead of fork. The
test suite passes. (I would not say that making this work was that
straightforward though.)
That branch also supports the starting of processes via a server
process. That gives an alternative solution to the problem of mixing
fork() with threads, but has the advantage of being as fast as the
default fork start method. However, it does not work on systems where
fd passing is unsupported like OpenSolaris.
--
Richard
More information about the Python-ideas
mailing list