(defclass metalock (c2mop:standard-class) ((locks :type list :accessor locks))) (defmethod c2mop:validate-superclass ((class metalock) (metaclass standard-class)) t) (defmethod c2mop:validate-superclass ((class standard-class) (metaclass metalock)) t) (defclass locked-object () ((arr :initform "oof" :accessor arr-access)) (:metaclass metalock)) (defparameter *lock* (bt:make-lock)) ;; (defmethod c2mop:slot-value-using-class :around ((class metalock) object slotd) ;; (bt:with-lock-held (*lock*) ;; (print "lock held") ;; (let ((val (call-next-method))) ;; (print "lock dropped") ;; val))) (defun slot-names-to-lock-alist (slot-names) (check-type slot-names list) (mapcar (lambda (name) (cons name (bt:make-lock))) slot-names)) (defmethod c2mop:compute-slots ((class metalock)) (let* ((normal-slots (call-next-method)) (slot-names (mapcar #'c2mop:slot-definition-name normal-slots)) (slot-names-lock-alist (slot-names-to-lock-alist slot-names))) (cons (make-instance 'c2mop:effective-slot-definition :name 'slot-locks :initform `',slot-names-lock-alist :initfunction #'(lambda () slot-names-lock-alist) :class (find-class 'c2mop:standard-slot-definition)) normal-slots))) ;;;;error There is no applicable method for the generic function # when called with arguments (#). [Condition of type SB-PCL::NO-APPLICABLE-METHOD-ERROR] Restarts: 0: [RETRY] Retry calling the generic function. 1: [RETRY] Retry SLY mREPL evaluation request. 2: [*ABORT] Return to SLY's top level. 3: [ABORT] abort thread (#) Backtrace: 0: ((:METHOD NO-APPLICABLE-METHOD (T)) # #) [fast-method] 1: ((LAMBDA (SB-PCL::.ARG0. SB-INT:&MORE SB-PCL::.MORE-CONTEXT. SB-PCL::.MORE-COUNT.)) # # (#)) 3: (SB-PCL::STD-COMPUTE-SLOTS-AROUND # (# #)) 4: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN SB-PCL::UPDATE-CLASS)) 5: ((FLET "WITHOUT-INTERRUPTS-BODY-29" :IN SB-THREAD::CALL-WITH-RECURSIVE-LOCK)) 6: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK # # T NIL) 8: ((:METHOD MAKE-INSTANCE (CLASS)) #) [fast-method] 9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MAKE-INSTANCE (QUOTE LOCKED-OBJECT)) #) 10: (EVAL (MAKE-INSTANCE (QUOTE LOCKED-OBJECT))) 11: ((LAMBDA NIL :IN SLYNK-MREPL::MREPL-EVAL-1)) --more--