From 596b11b9c540d09e6138d09ee69624fe2b97e6b5 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 17 Feb 2008 18:10:35 +0100 Subject: Synchronise access to *LISP-MANAGED-INSTANCES*. darcs-hash:b2125c11d3e465a389dce6c91432790a706c579b --- Lisp/instance-management.lisp | 20 +++++++++++--------- 1 file 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*))) -- cgit v1.2.3