Sha256: cc5ae22b979e5a6a8bd7181a7a6726d4420b53549f2f8988be76a8fc6d7cef79
Contents?: true
Size: 302 Bytes
Versions: 26
Compression:
Stored size: 302 Bytes
Contents
def par_map(n, things, &block) queue = Queue.new things.each { |thing| queue << thing } threads = (1..n).collect do Thread.new do begin while true yield queue.pop(true) end rescue ThreadError end end end threads.each { |t| t.join } end
Version data entries
26 entries across 26 versions & 1 rubygems