I'm trying to write a program that will poll some website and that is
easily terminable. I have a similar Ruby program on a Linux machine that
polls my inbox to see if I have mail and, whenever I have new mail, prints
the \b character. This is done by putting the polling code in a loop in a
thread block while the main thread simply waits in a gets method. This
allows someone to exit the program simply by typing anything. However, when
I try this on Win32, it appears that the Ruby interpreter blocks in the gets
call and the other thread never gets any execution time.
So, there appears to be a great discrepancy between the implementations
on the two systems. Is this really the case? Why is this? Is this
necessarily so or can we change this? Shouldn't we like to change this?
What do you all think?
What follows is some example code. On my Win32 system, this program
only counts up to 102.
Thank you for looking over this...
puts 'start'
Thread.new do
count = 0
loop do
puts count
count += 1
end
end
gets