Class: CrapServer::ThreadPool

Inherits:
Object
  • Object
show all
Defined in:
lib/crap_server/thread_pool.rb

Instance Method Summary collapse

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