1.0.6.38: thread and interrupt safe ADD/REMOVE-METHOD
[sbcl.git] / src / pcl / defs.lisp
index 3bf72db..882a37f 100644 (file)
 
 (defvar *eql-specializer-table* (make-hash-table :test 'eql))
 
+(defvar *eql-specializer-table-lock*
+  (sb-thread::make-spinlock :name "EQL-specializer table lock"))
+
 (defun intern-eql-specializer (object)
-  (or (gethash object *eql-specializer-table*)
-      (setf (gethash object *eql-specializer-table*)
-            (make-instance 'eql-specializer :object object))))
+  ;; Need to lock, so that two threads don't get non-EQ specializers
+  ;; for an EQL object.
+  (sb-thread::with-spinlock (*eql-specializer-table-lock*)
+    (or (gethash object *eql-specializer-table*)
+        (setf (gethash object *eql-specializer-table*)
+              (make-instance 'eql-specializer :object object)))))
 
 (defclass class (dependent-update-mixin
                  definition-source-mixin