syscalls: 'with-file-lock' expands to a call to 'call-with-file-lock'.
* guix/build/syscalls.scm (call-with-file-lock): New procedure. (with-file-lock): Expand to a call to 'call-with-file-lock'.
This commit is contained in:
parent
b7178c22bf
commit
89ceb86ad4
|
@ -1083,17 +1083,19 @@ exception if it's already taken."
|
||||||
(close-port port)
|
(close-port port)
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
(define-syntax-rule (with-file-lock file exp ...)
|
(define (call-with-file-lock file thunk)
|
||||||
"Wait to acquire a lock on FILE and evaluate EXP in that context."
|
|
||||||
(let ((port (lock-file file)))
|
(let ((port (lock-file file)))
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
(lambda ()
|
(lambda ()
|
||||||
#t)
|
#t)
|
||||||
(lambda ()
|
thunk
|
||||||
exp ...)
|
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(unlock-file port)))))
|
(unlock-file port)))))
|
||||||
|
|
||||||
|
(define-syntax-rule (with-file-lock file exp ...)
|
||||||
|
"Wait to acquire a lock on FILE and evaluate EXP in that context."
|
||||||
|
(call-with-file-lock file (lambda () exp ...)))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Miscellaneous, aka. 'prctl'.
|
;;; Miscellaneous, aka. 'prctl'.
|
||||||
|
|
Loading…
Reference in New Issue