From: Robert Klemme Date: 2013-02-25T07:37:48+09:00 Subject: Re: Ruby Multithreaded producer-consumer problem On Sun, Feb 24, 2013 at 9:08 PM, Sean O'Halpin wrote: > I think we must have been looking at different versions of the code - > there's no @next_run in the version I responded to Too bad. > (http://www.ruby-forum.com/attachment/8128/orange_tree.rb). I guess I > should have made it clear which version I was trying to fix (there > appear to be quite a few). Note, I did mistakenly point to the OP's > first version in the description of the gist I wrote but that does not > use @next_run either. I take it you didn't look at > https://gist.github.com/seanohalpin/5023887. > > Also, why would @age need synchronization? In http://www.ruby-forum.com/attachment/8132/orange_tree.rb there is read access to @age from one thread (#pick_an_orange) and read write access from the other (#one_year_passes) => synchronization needed. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/