[issue4892] Sending Connection-objects over multiprocessing connections fails
report at bugs.python.org
Sat Apr 7 20:21:34 CEST 2012
sbt <shibturn at gmail.com> added the comment:
> But ForkingPickler could be used in multiprocessing.connection,
> couldn't it?
I suppose so.
Note that the way a connection handle is transferred between existing processes is unnecessarily inefficient on Windows. A background server thread (one per process) has to be started and the receiving process must connect back to the sending process to receive its duplicate handle.
There is a simpler way to do this on Windows. The sending process duplicates the handle, and the receiving process duplicates that second handle using DuplicateHandle() and the DUPLICATE_CLOSE_SOURCE flag. That way no server thread is necessary on Windows.
I got this to work recently for pickling references to file handles for mmaps on. (A server thread would still be necessary on Unix.)
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list