Class: Garcon::RubySingleThreadExecutor
- Includes:
- RubyExecutor, SerialExecutor
- Defined in:
- lib/garcon/task/single_thread_executor.rb
Constant Summary
Constants included from RubyExecutor
Garcon::RubyExecutor::FALLBACK_POLICY
Instance Attribute Summary
Attributes included from Executor
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ RubySingleThreadExecutor
constructor
Create a new thread pool.
Methods included from SerialExecutor
Methods included from Executor
#auto_terminate?, #can_overflow?, #serialized?
Methods included from RubyExecutor
#<<, #kill, #post, #running?, #shutdown, #shutdown?, #shuttingdown?, #wait_for_termination
Constructor Details
#initialize(opts = {}) ⇒ RubySingleThreadExecutor
Create a new thread pool.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/garcon/task/single_thread_executor.rb', line 34 def initialize(opts = {}) @queue = Queue.new @thread = nil @fallback_policy = opts.fetch(:fallback_policy, :discard) if !FALLBACK_POLICY.include?(fallback) raise ArgumentError, "#{fallback} is not a valid fallback policy" end init_executor enable_at_exit_handler!(opts) end |