blob: 1deba2c1ce6f24175903365cafd34ae23b92d344 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
(define-module (hnh util atomic)
:use-module (srfi srfi-18)
:export (with-mutex))
(define-syntax with-mutex
(syntax-rules ()
((_ mutex body ...)
(dynamic-wind
(lambda () (mutex-lock! mutex))
(lambda () body ...)
(lambda () (mutex-unlock! mutex))))))
|