Sha256: b894ff69dfca31feae9801c8463a2925c6c27c41b33c507c3bed110860c65e8e

Contents?: true

Size: 538 Bytes

Versions: 18

Compression:

Stored size: 538 Bytes

Contents

# -*- 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)
    expire = Time.now + Rainbows.server.timeout
    threads.delete_if do |thr|
      Rainbows.tick
      begin
        # blocking accept() may not wake up properly
        thr.raise(Errno::EINTR) if Time.now > expire && thr.stop?

        thr.run
        thr.join(0.01)
      rescue
        true
      end
    end until threads.empty?
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rainbows-4.7.0 lib/rainbows/join_threads.rb
rainbows-4.6.2 lib/rainbows/join_threads.rb
rainbows-4.6.1 lib/rainbows/join_threads.rb
rainbows-4.6.0.4.g4108 lib/rainbows/join_threads.rb
rainbows-4.6.0 lib/rainbows/join_threads.rb
rainbows-4.5.0 lib/rainbows/join_threads.rb
rainbows-4.4.3 lib/rainbows/join_threads.rb
rainbows-4.4.2 lib/rainbows/join_threads.rb
rainbows-4.4.1.1.gd5c8c lib/rainbows/join_threads.rb
rainbows-4.4.1 lib/rainbows/join_threads.rb
rainbows-4.4.0 lib/rainbows/join_threads.rb
rainbows-4.3.1 lib/rainbows/join_threads.rb
rainbows-4.3.0 lib/rainbows/join_threads.rb
rainbows-4.2.0 lib/rainbows/join_threads.rb
rainbows-4.1.0 lib/rainbows/join_threads.rb
rainbows-4.0.0 lib/rainbows/join_threads.rb
rainbows-3.4.0 lib/rainbows/join_threads.rb
rainbows-3.3.0 lib/rainbows/join_threads.rb