[slime-devel] Shutting down Swank within an Image.

Andrew Myers asm198 at gmail.com
Fri Nov 4 17:24:27 UTC 2011


Is this a problem in Lisp?  I know in C that's an issue since you're
just calling close on an integer but I had thought lisp would handle
that more gracefully.  Although I guess the behavior isn't specified
since saving an image is outside the spec?

The problem with cleaning up _before_ saving the image is that you
can't use the image any more.  I was hoping to have a solution that
didn't require an exit and restart every time an image was dumped.

Andrew

On Fri, Nov 4, 2011 at 12:03 PM, Nikodemus Siivola
<nikodemus at random-state.net> wrote:
> On 4 November 2011 17:54, Andrew Myers <asm198 at gmail.com> wrote:
>> I've got an updated version that seems to work quite well:
>>
>> (defun aux-save-image (image-name)
>>  (let ((old-restart excl:*restart-init-function*))
>>    (setf excl:*restart-init-function*
>>          (lambda ()
>>            (dolist (connection swank::*connections*)
>>              (format t "closing ~a~%" connection)
>>              (swank::close-connection connection nil nil))
>>            (when old-restart
>>              (funcall old-restart))))
>>    (excl:dumplisp :name image-name)
>>    (setf excl:*restart-init-function* old-restart)))
>>
>> Is there anything wrong with doing things this way?  I get the same
>
> Closing a connection on initialization is risky. Consider: what if the
> underlying FD has is already in use in the new image?
>
> You should clean up before you save, not when you initialize.
>
> Cheers,
>
>  -- Nikodemus
>




More information about the slime-devel mailing list