From: Joel VanderWerf Date: 2008-03-16T05:21:10+09:00 Subject: Re: How to make net-ping thread safe? Forgot to make the previous patch thread safe: --- net/ping/icmp.rb.bck 2008-03-15 13:19:42.000000000 -0700 +++ net/ping/icmp.rb 2008-03-15 13:19:42.000000000 -0700 @@ -1,5 +1,6 @@ $LOAD_PATH.unshift File.dirname(__FILE__) require 'ping' +require 'thread' module Net class Ping::ICMP < Ping @@ -38,8 +39,11 @@ end @seq = 0 + @seq_mutex = Mutex.new def self.next_seq - @seq = (@seq + 1) % 65536 + @seq_mutex.synchronize do + @seq = (@seq + 1) % 65536 + end end # Sets the number of bytes sent in the ping method. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407