From: Christopher Rose Date: 2007-04-24T01:46:04+09:00 Subject: threads demo from pickaxe book - newbie question All, Please forgive a newbie question - I have tried searching for errata on the Pickaxe book (2nd ed) but not found an answer. I am running Ruby 1.8.2 on WinXP. I type in, or source from file, the example - from pg. 143, copied below - into the interactive ruby prompt in the fxri tool. I get to the line t1.join ; t2.join and the tool hangs. Is this expected? Is there some better way(s) to debug thread-related issues? Thanks for any advice - Chris P.S. Could someone please explain the purpose of the 'super' command in this script? Thx - --------------------------------------------- # with my current version of fxri, this hangs require 'monitor' class Counter < Monitor attr_reader :count def initialize @count = 0 super end def tick synchronize do @count += 1 end end end c = Counter.new t1 = Thread.new { 100_000.times { c.tick } } t2 = Thread.new { 100_000.times { c.tick } } t1.join ; t2.join c.count -- Posted via http://www.ruby-forum.com/.