Class: Dramatis::Runtime::ThreadPool
- Inherits:
-
Object
- Object
- Dramatis::Runtime::ThreadPool
- Defined in:
- lib/dramatis/runtime/thread_pool.rb,
lib/dramatis/runtime/thread_pool.rb
Overview
:nodoc: all
Defined Under Namespace
Classes: PoolThread
Instance Method Summary collapse
-
#initialize ⇒ ThreadPool
constructor
A new instance of ThreadPool.
- #length ⇒ Object
- #new(&block) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ ThreadPool
Returns a new instance of ThreadPool.
14 15 16 17 18 19 |
# File 'lib/dramatis/runtime/thread_pool.rb', line 14 def initialize super @mutex = Mutex.new @threads = [] @state = :running end |
Instance Method Details
#length ⇒ Object
25 26 27 28 29 |
# File 'lib/dramatis/runtime/thread_pool.rb', line 25 def length @mutex.synchronize do @threads.length end end |
#new(&block) ⇒ Object
21 22 23 |
# File 'lib/dramatis/runtime/thread_pool.rb', line 21 def new &block checkout( &block ) end |
#reset ⇒ Object
9 10 11 12 |
# File 'lib/dramatis/runtime/thread_pool.rb', line 9 def reset shutdown @state = :running end |