PATCH: Make slime-snapshot/slime-restore work
Max Mikhanosha
max at openchat.com
Mon Jun 10 20:00:23 UTC 2013
Attached patch makes Slime Snapshot contribution work once again.
I have tested the following scenarios:
1. M-x slime-snapshot and M-x slime-restore, on a default SBCL build with
:spawn communication style
2. Same with dedicated output connection
3. C-u M-x slime-snapshot (saves in the background)
4. Restoring snapshot saved with different value of *use-dedicated-output-stream*
5. Save and restore snapshot without 'slime-repl loaded
6. All of the above re-tested on a single-threaded SBCL build, with
:fd-handler communication style
Details of the implementation:
1. Because SBCL can not fork() with multiple-threads running, patch
introduce a new mechanism called "Thread Stopper". It has single
entry point, SWANK:REGISTER-THREAD-STOPPER which adds a callback,
called by SWANK to stop/start background threads of various
libraries.
2. A new entry point SWANK:CALL-WITH-ONLY-INITIAL-THREAD will stop
all background threads (using the above thread stopper protocol),
except for the initial thread in the Lisp image, and restart them
3. Swank itself uses the thread stopper protocol, to register a
callback that will stop all the multithreaded connections
threads, and then restart them after the call to fork()
4. In the implementation of the above, there were several
swank-backend interface changed, and some added, namely
MAKE-FD-STREAM had gained element-type argument, backend
JOIN-THREAD added, and CREATE-REPL had new keyword argument
added.
The thread stopper interface is intentionally minimalist, with a
single entry point, as to simplify adding thread-stopper hooks to
libraries, they can dispatch on (fboundp) or such.
Regards,
Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snapshot.patch
Type: application/octet-stream
Size: 33640 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20130610/8f805cde/attachment.obj>
More information about the slime-devel
mailing list