about summary refs log tree commit homepage
path: root/lib/rainbows/rev_thread_pool/watcher.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-26 22:48:33 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-26 22:48:33 +0000
commita50c9d312b9d5274a95f2816b5f53a3738d0cb92 (patch)
tree266b30d91cd45a19c1867e3f8f774d355302e6cc /lib/rainbows/rev_thread_pool/watcher.rb
parent6741aa27e4c35724b5306644d3a391fce415b0c7 (diff)
downloadrainbows-a50c9d312b9d5274a95f2816b5f53a3738d0cb92.tar.gz
This should make classes easier to find and hopefully make
our code easier to follow.
Diffstat (limited to 'lib/rainbows/rev_thread_pool/watcher.rb')
-rw-r--r--lib/rainbows/rev_thread_pool/watcher.rb14
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