develooper Front page | perl.perl5.porters | Postings from June 2008

RE: IPC::Run [was: This Week on perl5-porters - 1-6 June 2008]

Thread Previous | Thread Next
From:
Jan Dubois
Date:
June 17, 2008 18:43
Subject:
RE: IPC::Run [was: This Week on perl5-porters - 1-6 June 2008]
Message ID:
0a1e01c8d0e4$9e9bf140$dbd3d3c0$@com
On Tue, 17 Jun 2008, Barrie Slaymaker wrote:
> 
> The need for pipes at the child end is because TCP sockets on Win32 seem
> to lose any unsent data from the child on child exit unless the child
> actually close()es the filehandle, which is not common practice.
> 
> Are Win32 pipes select()able now, in modern Windows and/or perls?

No, they are not, and I assume never will be. The whole select()
mechanism is really foreign to Windows internals. While winsock tries to
copy the POSIX API, the actual implementation is not a bitmap if file
ids, but an unsorted list of file handles. This makes the actual
select() implementation rather inefficient once you specify more than a
few handles (instead of random access by file id into a bitmap you now
have a linear search through a list of handles).

The "proper" way to do asynchronous I/O in Windows is to use I/O
completion ports:

   http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx

They will work for files, sockets, named pipes, mailslots. I'm not sure
how we could/should use them in Perl.  I also think they'll only be
available on Windows 2000 and later (they exist in the NT 3.5 kernel,
but I think they were not exported through the Win32 API layer).

Cheers,
-Jan



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About