fix various warnings with "check-warnings" target
[rainbows.git] / lib / rainbows / join_threads.rb
blobba67c9487d946fdcd9f565aebaf88d8a4fc5ca8b
1 # -*- encoding: binary -*-
2 # :enddoc:
3 # This module only gets loaded on shutdown
4 module Rainbows::JoinThreads
6   # blocking acceptor threads must be forced to run
7   def self.acceptors(threads)
8     threads.delete_if do |thr|
9       Rainbows.tick
10       begin
11         thr.run
12         thr.join(0.01)
13       rescue
14         true
15       end
16     end until threads.empty?
17   end
18 end