Sha256: 8fb10b1c0db087bbfbb8da94128351728109d131f368ef3d8c00bd43556b122a

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

module Birdwatcher
  module Concerns
    module Concurrency
      # The default size of thread pool
      # @private
      DEFAULT_THREAD_POOL_SIZE = 10.freeze

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

      module ClassMethods
      end

      # Create a new thread pool
      #
      # @param size [Integer] OPTIONAL: The size of the thread pool (default size if not specified)
      # @return [Thread::Pool]
      # @see https://github.com/meh/ruby-thread#pool
      def thread_pool(size = nil)
        Thread.pool(size || DEFAULT_THREAD_POOL_SIZE)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
birdwatcher-0.4.0 lib/birdwatcher/concerns/concurrency.rb
birdwatcher-0.3.1 lib/birdwatcher/concerns/concurrency.rb
birdwatcher-0.1.0 lib/birdwatcher/concerns/concurrency.rb