From: Giovanni Gigante
Subject: an interface for a threaded application
Date: 
Message-ID: <492303B8.50401@cidoc.iuav.it>
not sure if I should be posting this here, on a SBCL list, or on a SLIME 
list. Anyway...

I have a lisp application made of several threads (with SBCL). I need to 
enter commands to this thing (via a REPL), but also to monitor what some 
of these threads are doing in real time.

Just a single REPL window is not enough for this. In other realms, I 
would imagine something like a command window (or line), and another 
window where the output is continuously updated. (I realize this is the 
same UI model of those old MUD clients...)
Not sure how I can accomplish something similar in Lisp. I mean from a 
functional point of view; prettiness is not important.

I suppose I could design a shiny external client (with Flash, Java, AJAX 
etc etc) and connect it via a socket to another lisp thread acting as a 
communication server for my whole app, but I would prefer to avoid such 
complications.

For example, is it possible to have in SLIME multiple windows to the 
same SBCL image, and to instruct the threads to use one or the other to 
do their I/O?

gg

From: Zach Beane
Subject: Re: an interface for a threaded application
Date: 
Message-ID: <m3hc64x5u0.fsf@unnamed.xach.com>
Giovanni Gigante <····@cidoc.iuav.it> writes:

> I suppose I could design a shiny external client (with Flash, Java,
> AJAX etc etc) and connect it via a socket to another lisp thread
> acting as a communication server for my whole app, but I would prefer
> to avoid such complications.

You can use a non-shiny external client like telnet. I think that would
be pretty simple to do.

Zach
From: Joost Diepenmaat
Subject: Re: an interface for a threaded application
Date: 
Message-ID: <87d4gslv2x.fsf@zeekat.nl>
Giovanni Gigante <····@cidoc.iuav.it> writes:

> For example, is it possible to have in SLIME multiple windows to the
> same SBCL image, and to instruct the threads to use one or the other
> to do their I/O?

It's possible to open multiple REPLs in Slime/SBCL with threads using
M-x slime-connect, which may or may not be enough for what you're doing.

http://www.interactivecode.com/googles-summer-code-17/sbcl-how-get-repl-created-thread-35733/


-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
From: K Livingston
Subject: Re: an interface for a threaded application
Date: 
Message-ID: <d98f4727-088e-4120-812f-4300cb9841ad@j38g2000yqa.googlegroups.com>
On Nov 18, 12:04 pm, Giovanni Gigante <····@cidoc.iuav.it> wrote:
> I have a lisp application made of several threads (with SBCL). I need to
> enter commands to this thing (via a REPL), but also to monitor what some
> of these threads are doing in real time.

The threads can all just print output to any stream of your choosing.
That could be standard out/error or you could give them all their own
individual streams to print to.  You could connect those streams to
files, and then watch the output with something like "tail -f myfile",
or I don't know if emacs or slime has a more fancy way of doing that.
(you can just shell exec that from emacs too)

As far as getting the threads to redirect their output, you could have
them print to some designated stream, or inside of each thread let
bind over the value of *standard-output* etc.

> Just a single REPL window is not enough for this.

I guess that would depend on the problem, or how fast you are
updating.


I have also been known to do things like this where I'll have the
output generate a webpage that refreshes (or uses ajax to update)
every 2 to 5 seconds.  Then just point my web browser at it.


Kevin