+
+;;; This needs to be used recursively, in case a non-trivial user
+;;; defined ADD/REMOVE-DIRECT-METHOD method ends up calling another
+;;; function using the same lock.
+(defvar *specializer-lock* (sb-thread::make-spinlock :name "Specializer lock"))
+
+(defmethod add-direct-method :around ((specializer specializer) method)
+ ;; All the actions done under this lock are done in an order
+ ;; that is safe to unwind at any point.
+ (sb-thread::with-recursive-spinlock (*specializer-lock*)
+ (call-next-method)))
+
+(defmethod remove-direct-method :around ((specializer specializer) method)
+ ;; All the actions done under this lock are done in an order
+ ;; that is safe to unwind at any point.
+ (sb-thread::with-recursive-spinlock (*specializer-lock*)
+ (call-next-method)))
+