From 40445641f11f01c6a24bf96c8b80eed5fd33a512 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 28 Dec 2010 17:59:27 -0800 Subject: complete Rev => Coolio renaming We use Cool.io internally everywhere now, but preserve Rev-based models for anybody using them. --- lib/rainbows/coolio_thread_pool/client.rb | 8 ++++++++ lib/rainbows/coolio_thread_pool/watcher.rb | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 lib/rainbows/coolio_thread_pool/client.rb create mode 100644 lib/rainbows/coolio_thread_pool/watcher.rb (limited to 'lib/rainbows/coolio_thread_pool') diff --git a/lib/rainbows/coolio_thread_pool/client.rb b/lib/rainbows/coolio_thread_pool/client.rb new file mode 100644 index 0000000..303b8e2 --- /dev/null +++ b/lib/rainbows/coolio_thread_pool/client.rb @@ -0,0 +1,8 @@ +# -*- encoding: binary -*- +# :enddoc: +class Rainbows::CoolioThreadPool::Client < Rainbows::Coolio::ThreadClient + # QUEUE constant will be set in worker_loop + def app_dispatch + QUEUE << self + end +end diff --git a/lib/rainbows/coolio_thread_pool/watcher.rb b/lib/rainbows/coolio_thread_pool/watcher.rb new file mode 100644 index 0000000..9b0e97e --- /dev/null +++ b/lib/rainbows/coolio_thread_pool/watcher.rb @@ -0,0 +1,14 @@ +# -*- encoding: binary -*- +# :enddoc: +class Rainbows::CoolioThreadPool::Watcher < Coolio::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 -- cgit v1.2.3-24-ge0c7