From 9e1baf374a9e26b2e29f706ef3e65273410eedb9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Feb 2010 14:17:26 -0500 Subject: [PATCH] parallel: Make -j 0 do something reasonable (start all jobs at once). --- debian/changelog | 1 + parallel.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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--; } -- 2.39.5