Class: Fbp::Node_pool

Inherits:
Object
  • Object
show all
Defined in:
lib/fbp/fpb-thread-pool.rb

Overview

Description

The Node pool class is built upon Kim Burgestrand Pool class which provides thread pool management for Ruby. The Node pool provides a standard set of module functions that allow for setting the number of threads in the Pool and to shutdown the Pool.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(num_threads = 10) ⇒ Node_pool

:nodoc:



16
17
18
19
# File 'lib/fbp/fpb-thread-pool.rb', line 16

def initialize (num_threads = 10) #:nodoc:
  @num_threads = num_threads
  @pool = nil
end

Instance Attribute Details

#num_threadsObject

:nodoc:



14
15
16
# File 'lib/fbp/fpb-thread-pool.rb', line 14

def num_threads
  @num_threads
end

#poolObject (readonly)

:nodoc:



13
14
15
# File 'lib/fbp/fpb-thread-pool.rb', line 13

def pool
  @pool
end

Instance Method Details

#make_poolObject

:nodoc:



21
22
23
24
# File 'lib/fbp/fpb-thread-pool.rb', line 21

def make_pool   #:nodoc:
  return false if !@pool.nil?
  @pool = Pool.new(@num_threads)
end

#shutdownObject

:nodoc:



30
31
32
33
# File 'lib/fbp/fpb-thread-pool.rb', line 30

def shutdown   #:nodoc:
  @pool.shutdown if !@pool.nil?
  @pool = nil
end