diff options
author | Rich Hickey <richhickey@gmail.com> | 2007-09-06 14:48:00 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2007-09-06 14:48:00 +0000 |
commit | ed3b9128296635c864098d6ae8436a5ae9236b66 (patch) | |
tree | b0a6fecaabf36a0a563daa6ae8ee892c70b0cd09 /src | |
parent | 4b899d767856bc4d851d4fea48696a9e0534f3f9 (diff) |
added locking macro
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.clj | 6 |
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))))) |