From: SASADA Koichi Date: 2007-11-17T06:37:58+09:00 Subject: Re: Suggestion for native thread tests Hi, Eust�quio Rangel wrote: > 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. :-) I can't understand what do you mean. Where is a FIFO? On my laptop, this code doesn't block, but continues to show file contents. -- // SASADA Koichi at atdot dot net