[Win32utils-devel] rb_w32_select function patch

Daniel Berger djberg96 at gmail.com
Mon Apr 28 21:29:47 EDT 2008

Heesob Park wrote:
> Hi, all
> As you know, rb_w32_select don't work well with standard input.
> Here is test code:
> t = Thread.new {
>    while true
>      puts "printing a line"
>      sleep 2
>    end
>  }
> gets
> t.exit
> puts "exiting"
> Following is the first version of patch code of rb_w32_select  function 
> in win32.c
> It is inspired by cygwin select implementation code and adopted some 
> code from it.
> The basic idea is creating thread for each file descriptor and wait events.
> What's your thought about it?

I applied the patch and then tried to run the thread tests in my 
ruby_test test suite against Ruby 1.8.6 p114 on Windows XP, built with 
VC++ 8.

C:\Documents and Settings\djberge\workspace\ruby_test>ruby test_thread.rb
Loaded suite test_thread
rb:113: [BUG] Segmentation fault
ruby 1.8.6 (2008-03-03) [i386-mswin32_80]

This application has requested the Runtime to terminate it in an unusual 
Please contact the application's support team for more information.

Where "test_thread.rb" is just:

# test_thread.rb
$LOAD_PATH.unshift File.join(Dir.pwd, 'lib')

Dir['test/core/thread/**/*.rb'].each{ |f|
       require f
    rescue LoadError

Or you can just run 'rake test_thread' if you have Rake installed.

You can grab "ruby_test" out of the "shards" CVS repo.

  cvs -d :pserver:anonymous at rubyforge.org:/var/cvs/shards login
cvs -d :pserver:anonymous at rubyforge.org:/var/cvs/shards checkout ruby_test

Is it possible I applied the patch wrong? Do you happen to have a 
unified diff, i.e. "diff -u" output?



More information about the win32utils-devel mailing list