我的程序出现多线程错误,因此我想扩展 with-lock-grabbed 宏以跟踪进程获取的锁堆栈。我想通过简单地添加一个槽来处理来存储锁堆栈来做到这一点。
不幸的是,我不明白如何在运行时添加一个插槽而不破坏已经存在的内容。ensure-class 完全重新定义了类。我不想要这个,因为我不知道其他插槽进程已经有什么。
如何添加插槽?特别是,我想添加这两个插槽:
(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
)