From: Sean O'Halpin Date: 2013-02-25T09:43:55+09:00 Subject: Re: Ruby Multithreaded producer-consumer problem On Sun, Feb 24, 2013 at 10:37 PM, Robert Klemme wrote: > On Sun, Feb 24, 2013 at 9:08 PM, Sean O'Halpin wrote: >> >> 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. > Ah yes - thanks. I have a bad habit of thinking of integer read/writes as atomic but a Fixnum isn't that simple (nor is anything anyway with multiprocessors in the mix). Regards, Sean