summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lisp/instance-management.lisp20
1 files changed, 11 insertions, 9 deletions
diff --git a/Lisp/instance-management.lisp b/Lisp/instance-management.lisp
index 371e78f..1e2fa1a 100644
--- a/Lisp/instance-management.lisp
+++ b/Lisp/instance-management.lisp
@@ -22,14 +22,16 @@
(defun intern-lisp-managed-foreign-instance (&rest initargs &key pointer)
(let ((key (cffi:pointer-address pointer)))
- (or (gethash key *lisp-managed-instances* nil)
- (setf (gethash key *lisp-managed-instances*)
- (apply #'make-instance
- (intern-pointer-wrapper
- 'class
- :pointer (%objcl-object-get-class pointer))
- initargs)))))
+ (with-exclusive-access (*lisp-managed-instances*)
+ (or (gethash key *lisp-managed-instances* nil)
+ (setf (gethash key *lisp-managed-instances*)
+ (apply #'make-instance
+ (intern-pointer-wrapper
+ 'class
+ :pointer (%objcl-object-get-class pointer))
+ initargs))))))
(defun unintern-lisp-managed-foreign-instance (instance)
- (remhash (cffi:pointer-address (pointer-to instance))
- *lisp-managed-instances*))
+ (with-exclusive-access (*lisp-managed-instances*)
+ (remhash (cffi:pointer-address (pointer-to instance))
+ *lisp-managed-instances*)))