[ '--theme', '-t', GetoptLong::REQUIRED_ARGUMENT, "Select HTML theme to use" ],
+ [ '--mproc', '-m', GetoptLong::REQUIRED_ARGUMENT, "Specify the number of processors for multi-processors machines" ],
+
[ '--verbose-level', '-v', GetoptLong::REQUIRED_ARGUMENT, "Set max verbosity level (0: warnings, 1: important messages, " +
"2: other messages)" ],
]
when '--theme'
$theme = arg
+ when '--mproc'
+ $mproc = arg.to_i
+ $pids = Array.new()
+
when '--verbose-level'
$verbose_level = arg.to_i
return theme_file
end
-def sys(cmd)
- msg 1, cmd
- system(cmd)
+#- parallelizable sys
+def psys(cmd)
+ if $mproc
+ if pid = fork
+ $pids << pid
+ else
+ msg 1, cmd + ' &'
+ system(cmd)
+ exit 0
+ end
+ if $pids.length == $mproc
+ finished = Process.wait2
+ $pids.delete(finished[0])
+ $pids = $pids.find_all { |pid| Process.waitpid(pid, Process::WNOHANG) == nil }
+ end
+ else
+ msg 1, cmd
+ system(cmd)
+ end
end
def walk_source_dir
if orientation =~ /left - bottom/
convert_options += '-rotate -90 '
end
- sys "#{$convert} #{convert_options}-geometry 704x528 '#{img}' '#{dest_img}'"
+ psys("#{$convert} #{convert_options}-geometry 704x528 '#{img}' '#{dest_img}'")
end
}