From: Shashank Date Date: 2002-06-12T11:21:17+09:00 Subject: threads question (newbie) This is using Ruby 1.6.7 on Windows (mswin32). The following program without the sleep(0.01) stmt seems to hang/stall after creating 3 threads until one thread is done. Thus it takes over 35 seconds to finish. But with the sleep stmt it starts all the 10 threads concurrently and the entire process is over in about 10 to 12 seconds as expected. What am I missing ? TIA, -- Shanko ------------------------------------------------------------------ require 'thread' commands = [] 10.times { |i| commands << "ping 1.1.1.1 -n 10 -w 1000 > junk#{i}.txt" } puts commands,"-------------",`echo %TIME%` threads = [] for command in commands threads << Thread.new(command){ |myCmd| sleep(0.01); # try commenting this out `#{myCmd}` } end threads.each { |aThread| aThread.join } puts `echo %TIME%` ----------------------------------------------------------------------