A list of the functions currently called to perform special actions, including the one just added.
When some objects are garbage collected, you may require a "special action" to be performed as well. add-special-free-action
adds the function function to perform the special action. Note that the function is applied to all objects flagged for special-free-action, so the function function should check for the object's type, so that it only affects relevant objects. Also, it should be fast when called with other objects.
The functions flag-special-free-action and flag-not-special-free-action flag and unflag objects for action.
When function is called, the object is still alive but is no longer flagged for special free action. Normally, the object will be collected on the next garbage collection cycle, but you can also store it somewhere which will prevent this. It may even be passed to flag-special-free-action again.
(defun free-my-app (object)
(when (my-app-p object)
(free-some-external-resources object)))
(add-special-free-action 'free-my-app)
LispWorks User Guide and Reference Manual - 20 Sep 2017