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)
|
||||
#t)
|
||||
|
||||
(define-syntax-rule (with-file-lock file exp ...)
|
||||
"Wait to acquire a lock on FILE and evaluate EXP in that context."
|
||||
(define (call-with-file-lock file thunk)
|
||||
(let ((port (lock-file file)))
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
#t)
|
||||
(lambda ()
|
||||
exp ...)
|
||||
thunk
|
||||
(lambda ()
|
||||
(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'.
|
||||
|
Loading…
Reference in New Issue
Block a user