aboutsummaryrefslogtreecommitdiff
path: root/module/hnh/util/atomic.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-08 11:29:21 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-08 11:29:21 +0200
commitd8a52af2520d14035fc3a36a7aa3569f9856380a (patch)
treed4ef88ad3fec5acb40581c2d4d048b2a7ca11eae /module/hnh/util/atomic.scm
parentRepair litmus test. (diff)
downloadcalp-d8a52af2520d14035fc3a36a7aa3569f9856380a.tar.gz
calp-d8a52af2520d14035fc3a36a7aa3569f9856380a.tar.xz
Further rewrite of testrunner.
Move many of the atomic procedures into proper libraries.
Diffstat (limited to '')
-rw-r--r--module/hnh/util/atomic.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/module/hnh/util/atomic.scm b/module/hnh/util/atomic.scm
new file mode 100644
index 00000000..1deba2c1
--- /dev/null
+++ b/module/hnh/util/atomic.scm
@@ -0,0 +1,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))))))