Message152095
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. |
|
Date |
User |
Action |
Args |
2012-01-27 13:58:51 | sbt | set | recipients:
+ sbt, pitrou, tim.golden, jnoller, brian.curtin, python-dev |
2012-01-27 13:58:50 | sbt | set | messageid: <1327672730.99.0.239982977543.issue12328@psf.upfronthosting.co.za> |
2012-01-27 13:58:50 | sbt | link | issue12328 messages |
2012-01-27 13:58:49 | sbt | create | |
|