07-Mar-2013 16:50, Steven Schveighoffer пишет:
On Wed, 06 Mar 2013 16:57:39 -0500, Dmitry Olshansky
<dmitry.o...@gmail.com> wrote:
06-Mar-2013 21:00, Steven Schveighoffer пишет:
On Wed, 06 Mar 2013 11:45:54 -0500, Steven Schveighoffer
<schvei...@yahoo.com> wrote:
a while ago (2008 or 09 I believe?), I was using Tango's Process
object to execute programs on a remote agent, and forwarding all the
resulting data back over the network. On Linux, I used select to read
data as it arrived. On Windows, I think I had to spawn off a separate
thread to wait for data/child processes.
More coming back to me now -- Windows pipes actually suck quite a bit.
You can't use the normal mechanisms to wait for data on them.
I also needed to spawn threads so I could combine the event-driven wait
for socket data from the remote instance with the data from the pipes.
I seem to remember opening a socket to my own process in order to do
this.
There is async read/write on pipes.
Though no wait on pipes does suck.
Hm... I noted in the docs that async read/write is not supported:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365141(v=vs.85).aspx
"Asynchronous (overlapped) read and write operations are not supported
by anonymous pipes. This means that you cannot use the ReadFileEx and
WriteFileEx functions with anonymous pipes. In addition, the
lpOverlapped parameter of ReadFile and WriteFile is ignored when these
functions are used with anonymous pipes."
Hm.. how shitty. Especially since:
"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 e.g. this (Named pipe using overlapped I/O):
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365603(v=vs.85).aspx
--
Dmitry Olshansky