From: Joey Hess Date: Tue, 23 Feb 2010 19:17:26 +0000 (-0500) Subject: parallel: Make -j 0 do something reasonable (start all jobs at once). X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e1baf374a9e26b2e29f706ef3e65273410eedb9;p=moreutils parallel: Make -j 0 do something reasonable (start all jobs at once). --- diff --git a/debian/changelog b/debian/changelog index 3670373..b5d2a7f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ moreutils (0.39) UNRELEASED; urgency=low * Cap sillyness. Closes: #570815 * parallel: Fix exit code handling when commands are specified after -- + * parallel: Make -j 0 do something reasonable (start all jobs at once). -- Joey Hess Sun, 21 Feb 2010 13:16:10 -0500 diff --git a/parallel.c b/parallel.c index 94559ff..06f9041 100644 --- a/parallel.c +++ b/parallel.c @@ -201,7 +201,7 @@ int main(int argc, char **argv) { getloadavg(&load, 1); - if ((maxjobs > 0 && curjobs < maxjobs) || + if ((maxjobs == 0 || curjobs < maxjobs) || (maxload > 0 && load < maxload)) { if (argsatonce > arglen - argidx) argsatonce = arglen - argidx; @@ -211,7 +211,7 @@ int main(int argc, char **argv) { curjobs++; } - if (maxjobs > 0 && curjobs == maxjobs) { + if (maxjobs == 0 || curjobs == maxjobs) { returncode |= wait_for_child(0); curjobs--; }