Method: Concurrent::Agent#initialize
- Defined in:
- lib/concurrent/agent.rb
#initialize(initial, opts = {}) ⇒ Agent
Initialize a new Agent with the given initial value and provided options.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/concurrent/agent.rb', line 37 def initialize(initial, opts = {}) @value = initial @rescuers = [] @validator = Proc.new { |result| true } self.observers = CopyOnWriteObserverSet.new @serialized_execution = SerializedExecution.new @task_executor = OptionsParser.get_task_executor_from(opts) @operation_executor = OptionsParser.get_operation_executor_from(opts) init_mutex (opts) end |