From d63db1ce4e8b30459bd3e67da619531f2741f9bf Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 24 Mar 2018 01:58:42 +0100 Subject: base: Rewrite 'child-cleanup' * src/mcron/base.scm (child-cleanup): Use recursion instead of 'do'. --- src/mcron/base.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mcron/base.scm') diff --git a/src/mcron/base.scm b/src/mcron/base.scm index 951c1d7..2f1c060 100644 --- a/src/mcron/base.scm +++ b/src/mcron/base.scm @@ -182,13 +182,13 @@ next value." (job:next-time-set! job ((job:next-time-function job) (current-time)))))) -;; Give any zombie children a chance to die, and decrease the number known to -;; exist. - (define (child-cleanup) - (do () ((or (<= number-children 0) - (eqv? (car (waitpid WAIT_ANY WNOHANG)) 0))) - (set! number-children (- number-children 1)))) + ;; Give any zombie children a chance to die, and decrease the number known + ;; to exist. + (unless (or (<= number-children 0) + (= (car (waitpid WAIT_ANY WNOHANG)) 0)) + (set! number-children (- number-children 1)) + (child-cleanup))) (define* (run-job-loop #:optional fd-list #:key (schedule %global-schedule)) ;; Loop over all job specifications, get a list of the next ones to run (may -- cgit v1.2.3