diff options
Diffstat (limited to 'lib/rainbows/rev_thread_pool/watcher.rb')
-rw-r--r-- | lib/rainbows/rev_thread_pool/watcher.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rainbows/rev_thread_pool/watcher.rb b/lib/rainbows/rev_thread_pool/watcher.rb new file mode 100644 index 0000000..2419066 --- /dev/null +++ b/lib/rainbows/rev_thread_pool/watcher.rb @@ -0,0 +1,14 @@ +# -*- encoding: binary -*- +# :enddoc: +class Rainbows::RevThreadPool::Watcher < Rev::TimerWatcher + G = Rainbows::G + + def initialize(threads) + @threads = threads + super(G.server.timeout, true) + end + + def on_timer + @threads.each { |t| t.join(0) and G.quit! } + end +end |