On Apr 17, 2007, at 9:30 AM, Nikodemus Siivola wrote:

Jonathon McKitrick wrote:
This is the way I've been stopping threads before saving an image:
  (dolist (thread (sb-thread:list-all-threads))
    (unless (eq thread sb-thread:*current-thread*)
      (sb-thread:terminate-thread thread)))
it works fine on OSX Intel (with experimental threads), and used to work on debian linux.  Now, though, when saving the image I get this error, as if I had not stopped the threads:

Note that TERMINATE-THREAD may return before the thread has exited, and the
thread may refuse do die or even spin a new thread as it dies:

 (defun horror () (unwind-protect (loop) (make-thread 'horror) (horror)))

 (make-thread 'horror :name "have luck killing me!")

Assuming that all your threads are willing to die nicely (not that
TERMINATE-THREAD is ever quite safe), you should do JOIN-THREAD after
the termination call to ensure the thread has finished.


It seems that the linux version (which I use for production) is still at version 1.0.3 at sbcl.org.  It's not until 1.0.4 that JOIN-THREAD appears.

Also, do you possibly have something in *SAVE-HOOKS* that spins a new thread?


The only threads I am shutting down are the hunchentoot server thread.  I call STOP-SERVER first, then iterate all remaining threads.  Perhaps I'll post a question to the hunchentoot list on this one.


--
Jonathon McKitrick
jmckitrick@reedlarkeygroup.com