From 4711fc6145e0ffccf42c294a9a4583fc7d8aa005 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 14 May 2021 09:52:02 +0100 Subject: Simplify the work queue loop --- guix-build-coordinator/utils.scm | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'guix-build-coordinator') diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index f35e9f1..101a246 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -733,20 +733,13 @@ References: ~a~%" (+ 9 (time-second (current-time)))) ;; Another thread could have taken the job in the ;; mean time - (begin - (if (q-empty? queue) - (unlock-mutex queue-mutex) - ;; thread-process-job will unlock queue-mutex - (thread-process-job thread-index)) - (loop)) - (if (too-many-threads?) - (stop-thread) - (begin - (unlock-mutex queue-mutex) - (loop)))) - (begin - (thread-process-job thread-index) - (loop)))))))) + (if (q-empty? queue) + (unlock-mutex queue-mutex) + ;; thread-process-job will unlock queue-mutex + (thread-process-job thread-index)) + (unlock-mutex queue-mutex)) + (thread-process-job thread-index))) + (loop))))) (define start-new-threads-if-necessary (let ((previous-thread-started-at (make-time time-monotonic 0 0))) -- cgit v1.2.3