diff options
Diffstat (limited to 'lib/rake')
-rw-r--r-- | lib/rake/cpu_counter.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/rake/cpu_counter.rb b/lib/rake/cpu_counter.rb index d7c92a6cbe..6d0b878b19 100644 --- a/lib/rake/cpu_counter.rb +++ b/lib/rake/cpu_counter.rb @@ -44,6 +44,18 @@ module Rake end end + begin + require 'etc' + rescue LoadError + else + if Etc.respond_to?(:nprocessors) + undef count + def count + return Etc.nprocessors + end + end + end + def count_via_java_runtime Java::Java.lang.Runtime.getRuntime.availableProcessors rescue StandardError |