[Win32utils-devel] Latest rb_win32_select patch

Daniel Berger djberg96 at gmail.com
Sun May 11 23:35:47 EDT 2008


Park Heesob wrote:
> Hi,
> ----- Original Message ----- 
> From: "Daniel Berger" <djberg96 at gmail.com>
> To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org>
> Sent: Monday, May 12, 2008 5:39 AM
> Subject: [Win32utils-devel] Latest rb_win32_select patch
> 
> 
>> Hi Park,
>>
>> I tried your latest patch and ran the sample code:
>>
>> readPipe, writePipe = IO.pipe
>>
>> t = Thread.new{
>>    sleep 5
>>    while true
>>       sleep 0.1
>>       puts "got #{readPipe.readline.length} bytes"
>>    end
>> }
>>
>> i = 1
>> while true
>>   i += 1
>>   sleep 1
>>   puts "hello from main"
>>   if i > 3
>>     writePipe.puts "a"*2048
>>   end
>> end
>> t.join
>>
>> At the console I typed the word "world", let it run for a bit, then hit 
>> Ctrl-C. It mostly seems to work. Here was the difference between Ruby 
>> with your patch and JRuby 1.1.1.
>>
>> # Ruby 1.8.6-114 with patch
>> C:\Documents and Settings\djberge\workspace>ruby pipe_test.rb
>> hello from main
>> hello from main
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> pipe_test.rb:14:in `sleep': Interrupt
>>         from pipe_test.rb:14
>>
>> C:\Documents and Settings\djberge\workspace>world
>> 'world' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> # Jruby 1.1.1
>>
>> C:\Documents and Settings\djberge\workspace>c:\jruby\bin\jruby pipe_test.rb
>> hello from main
>> hello from main
>> hello from main
>> hello from main
>> hello from main
>> got 2049 bytes
>> got 2049 bytes
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> hello from main
>> got 2049 bytes
>> Terminate batch job (Y/N)? y
>>
>> Is the difference anything we should worry about?
>>
> The patch is very experimental and it comes with ABSOLUTELY NO WARRANTY :)
> The still remaining problem is the incorrect or unwanted console input handling.
> I hope someone would fix the problem. 

Sorry if I sounded too critical. I'm just not sure what the proper 
behavior should be and I'm trying to work it out.

I'll see what I can come up with as far as a patch (assuming one is 
needed). I think our options are easier if we limit ourselves to Win2k 
or later (or even XP or later).

This is still a HUGE improvement over the current MRI behavior. :)

Regards,

Dan


More information about the win32utils-devel mailing list