From: JB Date: 2003-12-15T23:22:15+09:00 Subject: Re: threads and io Extract of Ruby manual: Threads and Processes "And if some thread happens to make a call to the operating system that takes a long time to complete, all threads will hang until the interpreter gets control back. " This is what hapens when I call $stdin.gets Here is a simplier program to show the problem require 'thread' mutex = Mutex.new $i = 0 thread1 = Thread.new() { while(1) mutex.synchronize do $i = $i + 1 end end } loop = true print "Q to quit\n" while(loop) c= $stdin.gets loop = false if (c=~ /Q.*/) mutex.synchronize do print "i=",$i,"\n" $i = 0 end end