Skip to content

Instantly share code, notes, and snippets.

@rpav
Last active December 30, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpav/7832108 to your computer and use it in GitHub Desktop.
Save rpav/7832108 to your computer and use it in GitHub Desktop.
sbcl won't finalize until the thread is done?
(defclass finalize-test () ())
(defmethod initialize-instance ((instance finalize-test) &key &allow-other-keys)
(bt:make-thread (lambda () (sleep 300)))
(tg:finalize instance
(lambda ()
(format t "I am all done.~%"))))
(make-instance 'finalize-test)
(cl-user::gc :full t)
;; Same problem:
(defclass finalize-test () ())
(defun make-my-thread ()
(bt:make-thread (lambda () (sleep 300))))
(defmethod initialize-instance ((instance finalize-test) &key &allow-other-keys)
(make-my-thread)
(tg:finalize instance
(lambda ()
(format t "I am all done.~%"))))
(make-instance 'finalize-test)
(cl-user::gc :full t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment