Bug/Weak Implementation? popen* routines can't handle simultaneous read/write?
Nick Craig-Wood
nick at craig-wood.com
Sun Jun 10 01:36:25 EDT 2007
dmoore <damienlmoore at gmail.com> wrote:
> On Jun 8, 12:30 pm, Nick Craig-Wood <n... at craig-wood.com> wrote:
> > Windows has a really strange idea of non-blocking IO - it uses
> > something called overlapped io. You or in the FILE_FLAG_OVERLAPPED
> > flag when you create the file/pipe. You then pass in overlap buffers
> > for reading writing.
> >
>
> the wx guys appear to do it differently (unless FILE_FLAG_OVERLAPPED
> is implicit in the calls they make)
>
> take a look at:
> http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/src/msw/utilsexc.cpp?rev=1.88&content-type=text/vnd.viewcvs-markup
>
> a reasonably well-documented wxExecute function handles all the messy
> win32 api calls and wraps the process in a wxProcess object and the
> streams in wxInputStream / wxOutputStream (also see the wxExecuteDDE
> function)
You are right, named pipes seem to have a non blocking mode.
Here is the lowdown from
http://msdn2.microsoft.com/en-US/library/aa365605.aspx
Both pipe clients and pipe servers can change a pipe handle's wait
mode by specifying either PIPE_WAIT or PIPE_NOWAIT in a call to the
SetNamedPipeHandleState function.
Note The nonblocking-wait mode is supported for compatibility with
Microsoft® LAN Manager version 2.0. This mode should not be used to
achieve overlapped input and output (I/O) with named
pipes. Overlapped I/O should be used instead, because it enables
time-consuming operations to run in the background after the
function returns. For more information about overlapped I/O, see
Synchronous and Overlapped Input and Output.
So it has a nonblocking mode but you shouldn't use it!
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list