class Rake::ThreadPool

def start_thread # :nodoc:

:nodoc:
def start_thread # :nodoc:
  @threads_mon.synchronize do
    next unless @threads.count < @max_active_threads
    t = Thread.new do
      begin
        while safe_thread_count <= @max_active_threads
          break unless process_queue_item
        end
      ensure
        @threads_mon.synchronize do
          @threads.delete Thread.current
          stat :ended, thread_count: @threads.count
          @join_cond.broadcast if @threads.empty?
        end
      end
    end
    @threads << t
    stat(
      :spawned,
      new_thread: t.object_id,
      thread_count: @threads.count)
    @total_threads_in_play = @threads.count if
      @threads.count > @total_threads_in_play
  end
end