summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2007-09-06 14:48:00 +0000
committerRich Hickey <richhickey@gmail.com>2007-09-06 14:48:00 +0000
commited3b9128296635c864098d6ae8436a5ae9236b66 (patch)
treeb0a6fecaabf36a0a563daa6ae8ee892c70b0cd09 /src
parent4b899d767856bc4d851d4fea48696a9e0534f3f9 (diff)
added locking macro
Diffstat (limited to 'src')
-rw-r--r--src/boot.clj6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/boot.clj b/src/boot.clj
index 5ba9f0ea..623d9664 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -154,3 +154,9 @@
(defn identity [x] x)
+(defmacro locking [x & body]
+ (let [gsym (gensym)]
+ (list 'let (vector gsym x)
+ (list 'try-finally
+ (cons 'do (cons (list 'monitor-enter gsym) body))
+ (list 'monitor-exit gsym)))))