From: JB Date: 2003-12-12T23:27:15+09:00 Subject: threads and io I have soe problems whitn treads and I/O. My program starts severals threads that open tcp connections. The main thread waits the user to press Q to stop the program. It seems that the gets fonction blocks all my threads !!! How is it possible? What did I wrong? Thanks alot. there is my programm require 'socket' #parametrers $host = $*[0] $port = $*[1] $number = $*[2] $number = 1 if ($number == nil) $number = $number.to_i #start threads threads = [] for i in 1..($number) threads << Thread.new(i) { |i| sleep (rand(10)) while(1) t = TCPSocket.new($host,$port) sleep (rand(10)) t.close sleep (rand(10)) end } end print "Q to quit\n" while(!($stdin.gets =~ /Q.*/)) end