summaryrefslogtreecommitdiff
path: root/Lisp/internal-utilities.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-16 16:19:39 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-16 16:19:39 +0100
commit36508100346b3159ee3f1fade42a534df8fe15ec (patch)
treedcd4b5517beb78c673425916733f4fa2a11090fc /Lisp/internal-utilities.lisp
parent89994d1bdaa674e92d3c647249cb7ff9bb85f2d9 (diff)
Add a few locking utility stubs.
darcs-hash:89727f37535b1a2b8360f2e9055952034fd6db9f
Diffstat (limited to 'Lisp/internal-utilities.lisp')
-rw-r--r--Lisp/internal-utilities.lisp27
1 files changed, 25 insertions, 2 deletions
diff --git a/Lisp/internal-utilities.lisp b/Lisp/internal-utilities.lisp
index 1c54068..87746b9 100644
--- a/Lisp/internal-utilities.lisp
+++ b/Lisp/internal-utilities.lisp
@@ -19,8 +19,31 @@
(defmacro atomically (&body body)
- ;; FIXME: Use a reentrant global lock here.
- `(progn ,@body))
+ ;; FIXME
+ `(progn ,@body)
+ #+(or)
+ `(prog2
+ (objcl-acquire-global-lock)
+ ,@body
+ (objcl-release-global-lock)))
+
+
+(defmacro with-exclusive-access ((&rest objects) &body body)
+ (etypecase objects
+ (null `(progn ,@body))
+ (cons `(with-lock ,(first objects)
+ (with-exclusive-access (,(rest objects))
+ ,@body)))))
+
+
+(defmacro with-lock (object &body body)
+ ;; FIXME: Implement LOCK-FOR-OBJECT.
+ (let ((lock (gensym "LOCK")))
+ `(let ((,lock (lock-for-object ,object)))
+ (prog2
+ (%objcl-acquire-lock ,lock)
+ (progn ,@body)
+ (%objcl-release-lock ,lock)))))
(defun featurep (symbol)