From: Joel VanderWerf Date: 2006-06-21T06:35:28+09:00 Subject: Re: C Threads and Ruby Simon Kr�ger wrote: > Francis Cianfrocca schrieb: >>>>> I typically use a pipe for this kind of synchronization. >> Me too. Crude but it works. > > Well, b*****it: > (sorry, no offense intended...) > > ------------------------------- > $stdout.sync = true > rd, wr = IO.pipe > > Thread.new do > loop do > puts 'foo!' Might help: wr.puts 'foo!' > sleep 0.5 > end > end > > sleep 2 > puts(rd.gets) > ------------------------------- > > ruby 1.8.4 (2005-12-24) [i386-mswin32] > gives me 4 foo!s and waits for the rest of eternity. > So blocking on a pipe isn't an option for platform independent code. > (or am I doing something wrong, please say I'm doing something wrong!) > > cheers > > Simon -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407