sbt <shibt...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue12328>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to