summaryrefslogtreecommitdiff
path: root/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
parent89994d1bdaa674e92d3c647249cb7ff9bb85f2d9 (diff)
Add a few locking utility stubs.
darcs-hash:89727f37535b1a2b8360f2e9055952034fd6db9f
Diffstat (limited to 'Lisp')
-rw-r--r--Lisp/internal-utilities.lisp27
-rw-r--r--Lisp/parameters.lisp2
2 files changed, 27 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)
diff --git a/Lisp/parameters.lisp b/Lisp/parameters.lisp
index 875adb8..a26908b 100644
--- a/Lisp/parameters.lisp
+++ b/Lisp/parameters.lisp
@@ -20,6 +20,8 @@
(defvar *runtime-initialisation-level* 0)
+(defvar *object-locks* (make-hash-table :test 'eql))
+
(defvar *boolean-return-exceptions* (make-hash-table :test #'equal))
(defvar *skip-retaining* nil)