class Concurrent::Agent

def initialize(initial, opts = {})

Options Hash: (**opts)
  • :copy_on_deref (String) -- call the given +Proc+ passing the internal value and
  • :freeze_on_deref (String) -- call +#freeze+ before returning the data
  • :dup_on_deref (String) -- call +#dup+ before returning the data
  • :timeout (Fixnum) -- maximum number of seconds before an update is cancelled

Parameters:
  • opts (Hash) -- the options used to define the behavior at update and deref
  • initial (Object) -- the initial value
def initialize(initial, opts = {})
  @value = initial
  @rescuers = []
  @validator = Proc.new { |result| true }
  @timeout = opts.fetch(:timeout, TIMEOUT).freeze
  @observers = CopyOnWriteObserverSet.new
  init_mutex
  set_deref_options(opts)
end