Class: Fbp::Node_pool
- Inherits:
-
Object
- Object
- Fbp::Node_pool
- 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
-
#num_threads ⇒ Object
:nodoc:.
-
#pool ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(num_threads = 10) ⇒ Node_pool
constructor
:nodoc:.
-
#make_pool ⇒ Object
:nodoc:.
-
#shutdown ⇒ Object
:nodoc:.
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_threads ⇒ Object
:nodoc:
14 15 16 |
# File 'lib/fbp/fpb-thread-pool.rb', line 14 def num_threads @num_threads end |
#pool ⇒ Object (readonly)
:nodoc:
13 14 15 |
# File 'lib/fbp/fpb-thread-pool.rb', line 13 def pool @pool end |
Instance Method Details
#make_pool ⇒ Object
: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 |
#shutdown ⇒ Object
: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 |