From 1c705d775092bee9504801f8b1322e53e0631d77 Mon Sep 17 00:00:00 2001 From: Marius Halden Date: Tue, 30 Aug 2016 21:08:14 +0200 Subject: Fix async wait --- batchd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'batchd.c') diff --git a/batchd.c b/batchd.c index 6fde5a8..ceb3911 100644 --- a/batchd.c +++ b/batchd.c @@ -13,7 +13,7 @@ #include #define DEFAULT_QUEUE_DIR "." -#define MAX_JOBS 1 +#define MAX_JOBS 2 int cur_jobs = 0; @@ -74,11 +74,11 @@ wait_all() { for (;;) { int r = waitpid(-1, NULL, WNOHANG); - if (r == -1) { + if (r == 0) + break; + else if (r == -1) { if (errno == ECHILD) break; - else if (errno == EWOULDBLOCK) - break; else err(1, "waitpid()"); } -- cgit v1.2.3