adding

@@mutex = Mutex.new unless defined? @@mutex