this was posted in moderated and seems appropriate to the recent threads
on event.pm running under winblows. i have no opinion or other facts, i
am just forwarding the post

uri


From: [EMAIL PROTECTED] (Kevin Heath)
Subject: Re: Using 4-arg select with a pipe
Newsgroups: comp.lang.perl.moderated
Date: Fri, 31 Mar 2000 21:48:45 GMT
Organization: @Home Network Canada
Path: 
typhoon.ne.mediaone.net!chnws05.ne.mediaone.net!24.128.1.91!chnws02.mediaone.net!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail
Lines: 47
Sender: [EMAIL PROTECTED]
Approved: [EMAIL PROTECTED]
Message-ID: <139F4.100830$[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
NNTP-Posting-Host: windlord.stanford.edu
User-Agent: slrn/0.9.6.2 (Linux)
X-Complaints-To: [EMAIL PROTECTED]
X-Trace: news2.rdc1.on.home.com 954539325 24.141.8.224 (Fri, 31 Mar 2000 13:48:45 PST)
NNTP-Posting-Date: Fri, 31 Mar 2000 13:48:45 PST
X-Original-NNTP-Posting-Host: 24.141.8.224
Xref: chnws05.ne.mediaone.net comp.lang.perl.moderated:5546

On Fri, 31 Mar 2000 19:05:57 +0100, Markus Laker
<[EMAIL PROTECTED]> wrote:
>Gaal Yahas <[EMAIL PROTECTED]> wrote:
>
>> 4-arg Select is only implemented on sockets under Win32. This saddening
>> detail is documented in perlport(1). If anyone knows of a way to work
>> around this (I need non-blocking reads of STDIN, myself), please tell
>> me too :-)
>
>If STDIN is a file, you can do something immeasurably uglier: fork off
>a separate task that does blocking reads and then chucks the data into
>a socket, which your main task can then test with C<select> and read
>with C<sysread>.

This is probably too late to be of any help, but FYI, that's similar
to what Cygwin's select(2) emulation does, except with Win32 threads
instead of forks.  I've just successfully ran both of your earlier
examples with a Cygwin compiled Perl binary[1] from Charles Wilson's
"cygutils" site (his patches to the Perl source are also there.)

Here's a mangled excerpt from the Cygwin User's Guide[2] on this:

        Our implementation allows select to function normally when given
        different types of file descriptors (sockets, pipes, handles, and
        a custom /dev/windows Windows messages pseudo-device).
        
        [...]This is accomplished by the main thread suspending itself,
        after starting one thread for each type of file descriptor
        present. Each thread polls the file descriptors of its respective
        type with the appropriate Win32 API call. [...]

If you want to give it a try, just grab either user.exe or full.exe
from one of Cygnus' mirrors[3], then run it to install the toolkit
and .DLL.  The cygutils tarball installs to usr\local, so you can
unpack it to '/' using Cygwin's bunzip2(1) and tar(1), (the library
translates UNIX pathnames to DOS/Win* ones) and put /usr/local on
the shebang line.

HTH, hopefully ActiveState will eventually incorporate a hack like
this into their version (assuming the performance penalties aren't
too horrid and it's actually reliable.)

-Kevin

[1] 
http://cygutils.netpedia.net/B20/perl/packages/perl5.005_03-cygwinb20-dynamic-v1.4.tar.bz2
[2] http://sourceware.cygnus.com/cygwin/cygwin-ug-net/overview49.html#OV-HI-SELECT
[3] http://sourceware.cygnus.com/cygwin/mirrors.html



-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

Reply via email to