I've merge Michael Bishop's "-j"/thread pool pull request into the master 
branch and intend to include it in the next release.  I've push the current 
code base out as Rake 0.9.3.beta.2, so feel free to download it and give it a 
try.

I am especially interested in developers running on windows to give the -j 
option with multitasks a spin.

Here's a rakefile I used in playing with the -j option.  Try rake with 
different numbers on the -j option and see how it behaves.

#--Start Rakefile --
#!/usr/bin/ruby -wKU

require 'thread'

$m = Mutex.new

def out(*str)
  $m.synchronize do
    puts(*str)
  end
end

DELAY = 0.1

TASKS = ('a'..'z').map { |prefix| "#{prefix}_task" }

TASKS.each do |name|
  desc "#{name} prereq"
  subtasks = ('0'..'9').map { |suffix| "#{name}_sub#{suffix}" }
  subtasks.each do |name|
    task name do
      sleep DELAY
    end
  end
  multitask name => subtasks do
    sleep DELAY
  end
end

multitask :main => TASKS

task :default do
  t = Time.now
  Rake::Task[:main].invoke
  delta = Time.now - t
  out "#{delta} seconds have passed"
end
#--End Rakefile --


-- 
-- Jim Weirich
-- [email protected]





_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to