From 9afcdde9a92f817330e4dfd5e1ef77a7bf461253 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 9 May 2011 00:21:23 +0000 Subject: xepoll_thread_pool: add optional :pool_size argument We're now able to configure the number of threads independently of worker_connections. --- lib/rainbows/xepoll_thread_pool.rb | 1 + lib/rainbows/xepoll_thread_pool/client.rb | 2 +- t/t0041-optional-pool-size.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rainbows/xepoll_thread_pool.rb b/lib/rainbows/xepoll_thread_pool.rb index 5ce89a0..b6eb55d 100644 --- a/lib/rainbows/xepoll_thread_pool.rb +++ b/lib/rainbows/xepoll_thread_pool.rb @@ -5,6 +5,7 @@ require "raindrops" module Rainbows::XEpollThreadPool include Rainbows::Base + extend Rainbows::PoolSize def init_worker_process(worker) super diff --git a/lib/rainbows/xepoll_thread_pool/client.rb b/lib/rainbows/xepoll_thread_pool/client.rb index b2c5928..1bfb1c2 100644 --- a/lib/rainbows/xepoll_thread_pool/client.rb +++ b/lib/rainbows/xepoll_thread_pool/client.rb @@ -33,7 +33,7 @@ module Rainbows::XEpollThreadPool::Client end QUEUE = Queue.new - APP_POOL = (1..20).each { Thread.new { app_run(QUEUE) } } + Rainbows::O[:pool_size].times { Thread.new { app_run(QUEUE) } } ep = SleepyPenguin::Epoll EP = ep.new diff --git a/t/t0041-optional-pool-size.sh b/t/t0041-optional-pool-size.sh index c074676..f5f6400 100755 --- a/t/t0041-optional-pool-size.sh +++ b/t/t0041-optional-pool-size.sh @@ -2,7 +2,7 @@ . ./test-lib.sh case $model in -NeverBlock|CoolioThreadPool) ;; +NeverBlock|CoolioThreadPool|XEpollThreadPool) ;; *) t_info "skipping $model.$T since it doesn't support :pool_size" exit -- cgit v1.2.3-24-ge0c7