From: Alfonso Caponi Date: 2009-07-30T21:52:27+09:00 Subject: thread exec Hi List, I've a problem with threads using exec, system or similar: ... ... domains = ['www.bim.com','www.bum.com','www.bam.com'] ... def check (host,domain,timeout) puts "checking... #{host} -> #{domain}" timeout(timeout) do begin `/usr/bin/nslookup #{domain} #{host}` rescue Timeout::Error end end end iplist.each { |host| threads << Thread.new(host) { |host| domains.each do |domain| check(host,domain,timeout) end } } ... With this code will be check only the first domains of three. Why? checking... 127.0.0.1 -> www.bim.com checking... 127.0.0.2 -> www.bim.com checking... 127.0.0.3 -> www.bim.com checking... 127.0.0.4 -> www.bim.com checking... 127.0.0.5 -> www.bim.com checking... 127.0.0.6 -> www.bim.com checking... 127.0.0.7 -> www.bim.com checking... 127.0.0.8 -> www.bim.com checking... 127.0.0.9 -> www.bim.com Thank you very much, Al -- Posted via http://www.ruby-forum.com/.