summaryrefslogtreecommitdiff
path: root/Lisp
diff options
context:
space:
mode:
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)