Module: ActionSubscriber::ThreadPools

Defined in:
lib/action_subscriber/thread_pools.rb

Constant Summary collapse

MUTEX =
::Mutex.new
THREADPOOL_DEFAULTS =
{
  :auto_terminate => true,
  :fallback_policy => :caller_runs,
  :max_queue => 10_000,
}.freeze

Class Method Summary collapse

Class Method Details

.setup_threadpool(name, settings) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/action_subscriber/thread_pools.rb', line 19

def self.setup_threadpool(name, settings)
  MUTEX.synchronize do
    @threadpools ||= {}
    fail ArgumentError, "a #{name} threadpool already exists" if @threadpools.has_key?(name)
    @threadpools[name] = create_threadpool(settings)
  end
end

.threadpoolsObject



13
14
15
16
17
# File 'lib/action_subscriber/thread_pools.rb', line 13

def self.threadpools
  MUTEX.synchronize do
    @threadpools ||= {}
  end
end