rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob ba67c9487d946fdcd9f565aebaf88d8a4fc5ca8b 370 bytes (raw)
$ git show v3.2.0:lib/rainbows/join_threads.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 
# -*- encoding: binary -*-
# :enddoc:
# 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

git clone https://yhbt.net/rainbows.git