[Win32utils-devel] Latest rb_win32_select patch

Daniel Berger djberg96 at gmail.com
Sun May 11 16:39:25 EDT 2008


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?

Regards,

Dan


More information about the win32utils-devel mailing list