diff options
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 |