[issue12328] multiprocessing's overlapped PipeConnection on Windows

sbt report at bugs.python.org
Fri Jan 27 14:58:50 CET 2012


sbt <shibturn at gmail.com> added the comment:

Quite honestly I don't like the way that polling a pipe reads a partial message from the pipe.  If at all possible, polling should not modify the pipe.

I think the cleanest thing would be to switch to byte oriented pipes on Windows and create PipeIO which subclasses RawIOBase.  (Since socket handles are really just overlapped file handles, PipeIO works for them too as long as closesocket() is used instead of CloseHandle().)  On Unix FileIO would be used instead.  Then Connection can just be a thin wrapper around a file object.

Polling on Windows can then be done by creating a wrapper for an overlapped object which represents a zero length read, and can be used with WaitForMultipleObjects().  This lets us implement a select-like wait() function in Python which works with both sockets and Connection objects.

Attached is an extension implementing PipeIO (and the overlapped wrapper), a Python module implementing Connection and wait(), and a test.

----------
Added file: http://bugs.python.org/file24340/PipeIO.zip

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12328>
_______________________________________


More information about the Python-bugs-list mailing list