Module: Birdwatcher::Concerns::Concurrency

Included in:
Birdwatcher::Command, Module
Defined in:
lib/birdwatcher/concerns/concurrency.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DEFAULT_THREAD_POOL_SIZE =

The default size of thread pool

10.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
# File 'lib/birdwatcher/concerns/concurrency.rb', line 8

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#thread_pool(size = nil) ⇒ Thread::Pool

Create a new thread pool

Parameters:

  • size (Integer) (defaults to: nil)

    OPTIONAL: The size of the thread pool (default size if not specified)

Returns:

  • (Thread::Pool)

See Also:



20
21
22
# File 'lib/birdwatcher/concerns/concurrency.rb', line 20

def thread_pool(size = nil)
  Thread.pool(size || DEFAULT_THREAD_POOL_SIZE)
end