Flowdock
method

synchronize

Importance_1
v3.2.13 - Show latest stable - 0 notes - Class: Module
synchronize(*methods) public

Synchronize access around a method, delegating synchronization to a particular mutex. A mutex (either a Mutex, or any object that responds to #synchronize and yields to a block) must be provided as a final :with option. The :with option should be a symbol or string, and can represent a method, constant, or instance or class variable. Example:

class SharedCache
  @@lock = Mutex.new
  def expire
    ...
  end
  synchronize :expire, :with => :@@lock
end
Show source
Register or log in to add new notes.