aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-05-14 09:52:02 +0100
committerChristopher Baines <mail@cbaines.net>2021-05-14 09:52:02 +0100
commit4711fc6145e0ffccf42c294a9a4583fc7d8aa005 (patch)
tree5d8c2561f931296027c2884003e38c8ead331ee7
parent6bbb0911e3b5df4efbeec12fa5207a0197e885fd (diff)
downloadbuild-coordinator-4711fc6145e0ffccf42c294a9a4583fc7d8aa005.tar
build-coordinator-4711fc6145e0ffccf42c294a9a4583fc7d8aa005.tar.gz
Simplify the work queue loop
-rw-r--r--guix-build-coordinator/utils.scm21
1 files changed, 7 insertions, 14 deletions
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)))