From: Hans Fugal Date: 2003-09-24T22:38:58+09:00 Subject: Re: When threads block On Tue, 23 Sep 2003 18:45:40 -0600, Hans Fugal wrote: > It's difficult to do any serious multi-threaded network programming when > the whole process blocks on system calls like read, write, and select. Is > this on a TODO list somewhere, or should I just accept it as a fact of > life? (and that may mean using a different language.) Ok, I jumped the gun just a little. On linux /most/ things don't block. But /some/ things do. e.g. thread = Thread.new do fifo = File.open("fifo","r") l = fifo.readline puts "#{Time.new} #{l}" end puts "#{Time.new} bar" thread.join Will block the entire process until the fifo is open. The following variation does not block the entire process, though: fifo = File.open("fifo","r") thread = Thread.new do l = fifo.readline puts "#{Time.new} #{l}" end puts "#{Time.new} bar" thread.join I say "most" because that's what the wise ones on #ruby-lang said, and indeed were surprised to see I had a counter example. Is there a list of these sorts of things? I need to know what to expect if I'm going to be able to use ruby for this (soft) real-time application.