Repositories of ABCL-specific code? / Kill runaway ABCL function and return to REPL?
alanruttenberg at gmail.com
Wed Jun 12 02:53:29 UTC 2019
On Tue, Jun 11, 2019 at 10:35 PM Elliott, Clark <elliott at depaul.edu> wrote:
> Dear ABCL experts,
> I am working on AI system development in LISP. I like using ABCL because
> of its easy portability to Windows, Mac, and Linux and its direct access to
> Java. I am running ABCL in emacs shells, often as several processes at
> once, communicating via sockets. The LISP is working very well indeed.
> Great job!
> I've slogged through getting things like sockets and threads
> running--mostly using apropos and guessing--but it takes a lot of time. I
> STRONGLY prefer to work from examples of running code.
> I would dearly love some tips on the following:
> 1. Are there repositories of ABCL-specific running code, small programs,
> utility applications and etc. showing the actual running of ABCL
> implementation-specific functions? Native ABCL networking? ABCL tricks?
> Examples of running programs using the native threads? Examples of small
> systems using Java-to-LISP and LISP-to-Java (beyond the given short
My project LSW2 <https://github.com/alanruttenberg/lsw2> uses ABCL
extensively. It isn't organized for documentation but browsing through it
you will find lots of usage of java libraries using JSS. The util directory
might have some relevant examples. I haven't used native threads - instead
there is lparallel <https://github.com/lmj/lparallel>
> 2. How can I stop a runaway ABCL LISP function and return to top-level
> LISP without having to blow away the emacs buffer, and thus my entire
> current LISP context? In other LISPs I've had some kind of control key
> sequence, but can't find one for ABCL.
There isn't one because java doesn't allow general interrupts. If a process
is grinding and never yielding then there's nothing you can do.
If you are writing the code then you can make sure you don't have long
loops without every yielding. I tend to throw in a (sleep .01)
What you can do is have a process run the process you care about, sleeping
most of the time. When sleeping it will recognize interrupts. The abort
handler can request a thread be destroyed. Maybe it will be maybe it won't
but at least you can be returned to the repl. util/geturl.lisp does this. I
also mucked around with making a unix-like "&" to put a form in the
background (running in its own thread). That's in util/background.lisp.
With that you can use (& form) to put form in the background. There's a
little doc at the top of the file.
Are you using slime? C-c C-c interrupts runaway just fine.
> (defun runaway ()
> (let ((n 0))
> (loop while (< (incf n) 10)
> ;; Pretend this ran away. How do I kill it in ABCL REPL?
> (sleep 1))))
> Thanks in advance for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the armedbear-devel