aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-12-06 15:16:30 +0000
committerChristopher Baines <mail@cbaines.net>2023-12-06 15:34:01 +0000
commit2439da4b2367e817c3de4705c4bebe8d3c04e50f (patch)
tree2a3129999e6dddd2a51dfd9254d79b806b5da878
parent89f2b96b796d39857e0ef9849ef4224d572acb27 (diff)
downloadbuild-coordinator-2439da4b2367e817c3de4705c4bebe8d3c04e50f.tar
build-coordinator-2439da4b2367e817c3de4705c4bebe8d3c04e50f.tar.gz
Move a hash-set! in the thread pool
To avoid unlocking and locking the mutex.
-rw-r--r--guix-build-coordinator/utils.scm9
1 files changed, 4 insertions, 5 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm
index 9d2e75a..d19f390 100644
--- a/guix-build-coordinator/utils.scm
+++ b/guix-build-coordinator/utils.scm
@@ -1132,6 +1132,10 @@ References: ~a~%"
(let loop ((last-job-finished-at (current-time time-monotonic)))
(lock-mutex pool-mutex)
+ (hash-set! running-job-args
+ thread-index
+ #f)
+
(if (too-many-threads?)
(stop-thread)
(let ((job-args
@@ -1151,11 +1155,6 @@ References: ~a~%"
(unlock-mutex pool-mutex)
(thread-process-job job-args)
- (with-mutex pool-mutex
- (hash-set! running-job-args
- thread-index
- #f))
-
(loop (current-time time-monotonic)))
(if (thread-idle-for-too-long? last-job-finished-at)
(stop-thread)