diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-05 10:44:52 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-05 11:13:43 +0000 |
commit | 90a86c9822238f01e8d60c9303b9a0da64351c7f (patch) | |
tree | b13a4384b526887c964f74b1b9e2a2927e5b86bd /lib/rainbows/join_threads.rb | |
parent | c9ca82c76f1eb0e06b0aa204a243d00f382579c5 (diff) | |
download | rainbows-90a86c9822238f01e8d60c9303b9a0da64351c7f.tar.gz |
acceptor thread pools could use some work, still
Diffstat (limited to 'lib/rainbows/join_threads.rb')
-rw-r--r-- | lib/rainbows/join_threads.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/rainbows/join_threads.rb b/lib/rainbows/join_threads.rb new file mode 100644 index 0000000..6636e7c --- /dev/null +++ b/lib/rainbows/join_threads.rb @@ -0,0 +1,18 @@ +# -*- encoding: binary -*- +# :nodoc: +# This module only gets loaded on shutdown +module Rainbows::JoinThreads + + # blocking acceptor threads must be forced to run + def self.acceptors(threads) + threads.delete_if do |thr| + Rainbows.tick + begin + thr.run + thr.join(0.01) + rescue + true + end + end until threads.empty? + end +end |