require "lazily/prefetching"

module Lazily

  module Enumerable

    def in_threads(max_threads, &block)
      collect do |item|
        Thread.new(item, &block)
      end.prefetch(max_threads - 1).collect do |thread|
        thread.join.value
      end
    end

  end

end

require "lazily/prefetching"

module Lazily

  module Enumerable

    def in_threads(max_threads, &block)
      collect do |item|
        Thread.new { block.call(item) }
      end.prefetch(max_threads - 1).collect do |thread|
        thread.join.value
      end
    end
  end

end

Revert "Thread.new takes arguments. That's handy."
Revert "Thread.new takes arguments. That's handy."

This reverts commit e7780633ac2473d3265903c4f680171b17217ee4.

It didn't work so well in Ruby 1.8.7.
