diff options
Diffstat (limited to 'guix-build-coordinator/utils.scm')
-rw-r--r-- | guix-build-coordinator/utils.scm | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index d19f390..7fe0470 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -1136,32 +1136,31 @@ References: ~a~%" thread-index #f) - (if (too-many-threads?) - (stop-thread) - (let ((job-args - (or (get-job (list-jobs)) - ;; #f from wait-condition-variable indicates a timeout - (if (wait-condition-variable - job-available - pool-mutex) - (get-job (list-jobs)) - #f)))) - (if job-args + (let ((job-args + (or (get-job (list-jobs)) + ;; #f from wait-condition-variable indicates a timeout + (if (wait-condition-variable + job-available + pool-mutex) + (get-job (list-jobs)) + #f)))) + (if job-args + (begin + (hash-set! running-job-args + thread-index + job-args) + + (unlock-mutex pool-mutex) + (thread-process-job job-args) + + (loop (current-time time-monotonic))) + (if (or (thread-idle-for-too-long? last-job-finished-at) + (too-many-threads?)) + (stop-thread) (begin - (hash-set! running-job-args - thread-index - job-args) - (unlock-mutex pool-mutex) - (thread-process-job job-args) - (loop (current-time time-monotonic))) - (if (thread-idle-for-too-long? last-job-finished-at) - (stop-thread) - (begin - (unlock-mutex pool-mutex) - - (loop last-job-finished-at)))))))))) + (loop last-job-finished-at))))))))) (define start-new-threads-if-necessary (let ((previous-thread-started-at (make-time time-monotonic 0 0))) |