Sha256: 3854602162c8c6b06b2978d710c3d988153eb84cdf41100a0a082f59cbc3f2b5
Contents?: true
Size: 872 Bytes
Versions: 59
Compression:
Stored size: 872 Bytes
Contents
module Listen # @private api module Internals module ThreadPool def self.add(&block) Thread.new { block.call }.tap do |th| (@threads ||= Queue.new) << th end end def self.stop return unless @threads ||= nil return if @threads.empty? # return to avoid using possibly stubbed Queue killed = Queue.new # You can't kill a read on a descriptor in JRuby, so let's just # ignore running threads (listen rb-inotify waiting for disk activity # before closing) pray threads die faster than they are created... limit = RUBY_ENGINE == 'jruby' ? [1] : [] killed << @threads.pop.kill until @threads.empty? until killed.empty? th = killed.pop th.join(*limit) unless th[:listen_blocking_read_thread] end end end end end
Version data entries
59 entries across 50 versions & 11 rubygems