From: Daniel Nugent Date: 2005-10-29T13:53:49+09:00 Subject: Re: What would it take to change the behaviour of variable assignment? It was a good shot. The thing is that DataFlow is not a collection. It would be a wrapper around a single object assigned to it that pauses the thread and forces it to pass when it has not been assigned a value. The thing that makes the DFVs interesting is that the code you're running wouldn't have to know it's being run in parallel to use the Dataflow variables properly. It would just use them and be cool with it. It is a bit of an esoteric concern, I'll admit. But I wanna see if I can make it work. See the edit to your attempt: On 10/28/05, Ara.T.Howard wrote: > harp:~ > cat a.rb > require 'thread' > > STDOUT.sync = true > > counter = Thread::new{ 42.times{|i| puts i; sleep 1} } > > foo = DataFlow::new > + bar = Thread::new(foo, "Monitor Thread"){|df, label| puts "#{ label } : #{ df }"} > > sleep 3 > > baz = Thread::new(foo, "Sleepy Thread") do |df, label| > puts "#{ label } : Going to sleep." > sleep 3 + df = "Hello World, sorry I'm late" > end > > bar.join > baz.join > > > harp:~ > ruby a.rb > 0 > 1 > 2 > Sleepy Thread : Going to sleep. > 3 > 4 > 5 > Monitor Thread : Hello World, sorry I'm late -- -Dan Nugent