My program is getting errors with multithreading, so I want to expand the with-lock-grabbed macro to keep track of the stack of locks a process acquires. I want to do this by simply adding a slot to process to store the lock-stack.
Unfortunately, I don't understand how to add a slot at runtime without destroying what's already there. ensure-class completely redefines the class. I don't want this, since I don't know what other slots process already has.
How can I add a slot? In particular, I would like to add these two slots:
(lock-stack :documentation "stores a list of all locks of the process.
Only used for debugging"
:type list
:initform nil
:accessor lock-stack-acc
)
(lock-stack-error-found :documentation "indicates that an error on the locks was already found.
Only used for debugging"
:type boolean
:initform nil
:accessor lock-stack-error-found-acc
)
Someone on GoogleGroups linked me to the answer: https://groups.google.com/group/comp.lang.lisp/msg/7e24e8417cd1b6e6?dmode=source