From: Bryan Richardson Date: 2008-07-26T00:44:09+09:00 Subject: Monitor Error when Joining Threads Hello all, *Note: this may get published twice... I posted via the email list but it never went through...* I'm getting the following error when I I try to join some threads: c:/ruby/lib/ruby/1.8/monitor.rb:215:in `mon_enter': undefined method `+' for nil:NilClass (NoMethodError) from simulator2.rb:48:in `join' from simulator2.rb:48:in `init' from simulator2.rb:48:in `each' from simulator2.rb:48:in `init' from simulator2.rb:163 For some reason @mon_count within monitor.rb is nil, but I'm not sure why any type of synchronization is being done at this point. Does Thread do some synchronization when join is called? Below is the code from simulator2.rb on line 48 (along with other potentially informative code): threads = Array.new outages.each do |range| @logger.debug "New thread -- Start: #{range.first}, Finish: #{range.last}" threads << Thread.new do Simulator2.new(@file, @interface, "c:\log-#{threads.length}.txt").run(range.first, range.last) end end threads.each { |thread| thread.join } I am doing some synchronization of methods and variables within the Simulator2#run method... but would this show up as coming from the Thread#join method? Just for clarification, yes I am creating a new instance of Simulator2 (which is the class which this code resides in). The code above resides in Simulator2#init. -- Thanks! Bryan -- Posted via http://www.ruby-forum.com/.