module Listen::Internals::ThreadPool

Just a wrapper for tests to avoid interfereing with Celluloid's threads

Public Class Methods

add(&block) click to toggle source
# File lib/listen/internals/thread_pool.rb, line 6
def self.add(&block)
  (@threads ||= Queue.new) << Thread.new { block.call }
end
stop() click to toggle source
# File lib/listen/internals/thread_pool.rb, line 10
def self.stop
  return unless @threads ||= nil

  killed = Queue.new
  killed << @threads.pop.kill until @threads.empty?
  killed.pop.join until killed.empty?
end