diff options
author | Christopher Baines <mail@cbaines.net> | 2021-05-28 17:21:11 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-05-28 17:21:11 +0100 |
commit | 230fafee5932e4233e4d66a84bd49f41b5067eb6 (patch) | |
tree | b3c1ed92282b638f1a52fa040a4e9a1c1db06d42 /guix-build-coordinator/utils.scm | |
parent | d7e6bd9ed0d4c35716475d27eb53b653cb0bbda1 (diff) | |
download | build-coordinator-230fafee5932e4233e4d66a84bd49f41b5067eb6.tar build-coordinator-230fafee5932e4233e4d66a84bd49f41b5067eb6.tar.gz |
Use dyanmic-wind when changing the GC configuration
These procedures actually increment/decrement a counter, so gc-enable might
not enable garbage collection if gc-disable has been called twice in a
row. dynamic-wind should ensure that gc-enable is always called after
gc-disable, even if thunk raises an exception for example.
Diffstat (limited to 'guix-build-coordinator/utils.scm')
-rw-r--r-- | guix-build-coordinator/utils.scm | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index 9be4f4c..44a08c8 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -255,11 +255,10 @@ upcoming chunk." (define (with-gc-protection thunk) (monitor - (gc-disable) - (call-with-values thunk - (lambda vals - (gc-enable) - (apply values vals))))) + (dynamic-wind + gc-disable + thunk + gc-enable))) (define (make-gc-guard-port port) (define (%put-char c) |