Class: CrapServer::ThreadPool
- Inherits:
-
Object
- Object
- CrapServer::ThreadPool
- Defined in:
- lib/crap_server/thread_pool.rb
Instance Method Summary collapse
-
#initialize(sockets) ⇒ ThreadPool
constructor
A new instance of ThreadPool.
- #run(&block) ⇒ Object
Constructor Details
#initialize(sockets) ⇒ ThreadPool
Returns a new instance of ThreadPool.
3 4 5 |
# File 'lib/crap_server/thread_pool.rb', line 3 def initialize(sockets) @sockets = sockets end |
Instance Method Details
#run(&block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/crap_server/thread_pool.rb', line 7 def run(&block) @block = block Thread.abort_on_exception = true threads = ThreadGroup.new config.pool_size.times do threads.add spawn_thread end sleep end |