lib/zold/thread_pool.rb
def add
      raise 'Block must be given to start()' unless block_given?
      latch = Concurrent::CountDownLatch.new(1)
      thread = Thread.start do
        Thread.current.name = @title
        VerboseThread.new(@log).run do
          latch.count_down
          yield
        end
      end
      latch.wait
      Thread.current.thread_variable_set(
        :kids,
        (Thread.current.thread_variable_get(:kids) || []) + [thread]
      )
      @threads << thread
    end
def add
      raise 'Block must be given to start()' unless block_given?
      latch = Concurrent::CountDownLatch.new(1)
      thread = Thread.start do
        Thread.current.name = @title
        VerboseThread.new(@log).run do
          latch.count_down
          yield
        end
      end
      latch.wait
      Thread.current.thread_variable_set(
        :kids,
        (Thread.current.thread_variable_get(:kids) || []) + [thread]
      )
      @threads << thread
    end
def add raise 'Block must be given to start()' unless block_given? latch = Concurrent :: CountDownLatch . new ( 1 ) thread = Thread . start do Thread . current . name = @title VerboseThread . new ( @log ) . run do latch . count_down yield end end latch . wait Thread . current . thread_variable_set ( :kids , ( Thread . current . thread_variable_get ( :kids ) || [ ] ) + [ thread ] ) @threads << thread end
Add a new thread
Add a new thread