[Twisted-Python] _dumbwin32proc and PIPE_NOWAIT

Manlio Perillo manlio_perillo at libero.it
Fri Sep 29 19:01:06 EDT 2006

From the msdn:

"""PIPE_NOWAIT 0x00000001 	

Nonblocking mode is enabled. In this mode, ReadFile, WriteFile, and
ConnectNamedPipe always return immediately. Note that nonblocking mode
is supported for compatibility with Microsoft® LAN Manager version 2.0
and should not be used to achieve asynchronous input and output (I/O)
with named pipes.

I really can't believe that win32 support for asynchronous I/O works
with named pipes but not with anonymous pipes...

By the way, instead of using a polling, why not to use a separate thread
that puts data into a DeferredQueue?


"""Anonymous pipes are implemented using a named pipe with a unique
name. Therefore, you can often pass a handle to an anonymous pipe to a
function that requires a handle to a named pipe.

And from:

"""A child process can inherit [...]

* Open handles returned by the CreateFile function. This includes
handles to files, console input buffers, console screen buffers, named
pipes, serial communication devices, and mailslots.

* Open handles to process, thread, mutex, event, semaphore, named-pipe,
anonymous-pipe, and file-mapping objects. These are returned by the
CreateProcess, CreateThread, CreateMutex, CreateEvent, CreateSemaphore,
CreateNamedPipe, CreatePipe, and CreateFileMapping functions, respectively.

So, why not to create a named pipe with an unique name, know to both the
 parent and the child process, as an example using an enviroment variable?

I think that using named pipes can simplify the _dumbwin32proc.
Moreover polling a named pipe is not an efficient operation
(reading the author of "Windows System Programming").

Lastly, the parent process, after creating a named pipe instance, can
wait for a client connection using ConnectNamedPipe.

Regards  Manlio Perillo

More information about the Twisted-Python mailing list