diff --git a/scheme/lib/sunet-utilities.scm b/scheme/lib/sunet-utilities.scm index f6b8d45..ec617dd 100644 --- a/scheme/lib/sunet-utilities.scm +++ b/scheme/lib/sunet-utilities.scm @@ -68,3 +68,10 @@ (define (dump fd) (copy-inport->outport fd (current-output-port))) +(define (with-lock lock thunk) + (dynamic-wind + (lambda () + (release-lock lock)) + thunk + (lambda () + (release-lock lock)))) diff --git a/scheme/packages.scm b/scheme/packages.scm index 4f2ac66..b5b3cad 100644 --- a/scheme/packages.scm +++ b/scheme/packages.scm @@ -222,7 +222,8 @@ dump system-fqdn copy-inport->outport - dotdot-check)) + dotdot-check + with-lock)) (define-interface handle-fatal-error-interface (export with-fatal-error-handler* @@ -617,6 +618,7 @@ srfi-13 dns let-opt ; :optional + locks handle-fatal-error) (files (lib sunet-utilities)))