Hi!
I'm checking 1.9 and I'm curious for some test which shows me that there
are really native threads there.
I made a test with two threads reading two files and one reading a FIFO,
but seems that the FIFO is blocking the other threads. Is this a valid
test for native threads? Using Java it works as expected. Here's the code:
files = %w(thread_test.txt thread_test.fifo thread_test2.txt)
threads = []
files.each_with_index do |item,index|
threads << Thread.new do
while true
puts "(#{index}) Reading #{item} on #{Time.now} ..."
puts File.read(item)
puts "-"*50
sleep 1
end
end
end
threads.first.join
Using an updated 1.9 it still blocks when reading the FIFO.
I need some suggestion of some test to prove that the native threads are
there. :-)
Best regards,
--
EustáÒuio "TaQ" Rangel
http://eustaquiorangel.com
"The only way to learn a new programming language is by writing programs
in it."
B. Kernighan & D. Ritchie