From: Eric Hodel Date: 2004-12-04T02:59:10+09:00 Subject: Re: [nuby] about ruby multithreading On 03 Dec 2004, at 08:12, Michael Neumann wrote: > James Edward Gray II wrote: >> On Dec 3, 2004, at 9:47 AM, Lionel Thiry wrote: >> Hmm, good question. I assume yes, but let's let someone who knows >> better than me answer this one... ;) > > Yes: > > Thread.new { > loop do > sleep 1 > p "." > end > } > > system("sleep 10000") > > And for IO operations, this is true, too. Ruby does not block on > read/write as it internally uses select. No, system does not block other ruby threads. $ cat x.rb STDOUT.sync = true Thread.new { loop do sleep 1 puts Time.now end } system("sleep 10") $ ruby -v x.rb ruby 1.8.2 (2004-11-06) [powerpc-darwin7.6.0] Fri Dec 03 09:57:47 PST 2004 Fri Dec 03 09:57:48 PST 2004 Fri Dec 03 09:57:49 PST 2004 Fri Dec 03 09:57:50 PST 2004 Fri Dec 03 09:57:51 PST 2004 Fri Dec 03 09:57:52 PST 2004 Fri Dec 03 09:57:53 PST 2004 Fri Dec 03 09:57:54 PST 2004 Fri Dec 03 09:57:55 PST 2004 $