Hi,
I'd like to interact with a running lisp process while it's executing a long-running function. Currently, any requests I make during the long running function call get pipelined until after the function call ends. As a contrived example, execute (sleep 10) at the REPL, then try to compile (C-c C-c) a function in another source file while Lisp is busy sleeping.
I've been reading the manual page on swank communication style, and it sounds like the :spawn option does what I want. Unfortunately, thread support is not universal, and happens to missing on one of my main development platforms (SBCL on Windows). Is there any way I can work around this (e.g. add swank callbacks to my application)? I know this is kind of a long shot but it would be kind of nice to get this working independent of implementation thread support.
Thanks.
* Elliott Slaughter [2009-12-07 10:30+0100] writes:
Hi,
I'd like to interact with a running lisp process while it's executing a long-running function. Currently, any requests I make during the long running function call get pipelined until after the function call ends. As a contrived example, execute (sleep 10) at the REPL, then try to compile (C-c C-c) a function in another source file while Lisp is busy sleeping.
I've been reading the manual page on swank communication style, and it sounds like the :spawn option does what I want. Unfortunately, thread support is not universal, and happens to missing on one of my main development platforms (SBCL on Windows). Is there any way I can work around this (e.g. add swank callbacks to my application)? I know this is kind of a long shot but it would be kind of nice to get this working independent of implementation thread support.
There's also :sigio which doesn't need threads but probably also not available on Windows.
Your application could call swank::handle-requests from time to time. The timeout argument should be 0 to poll the socket without blocking. :fd-handler style does just that whenever SBCL performs a blocking read. For this, read-char-no-hang should work for sockets which was broken the last time I checked. Maybe it's fixed now.
From Emacs, entering the debgger with C-c C-b should work most of the
time (as usual, may be broken on Windows). And it should be possible to use most commands on top of the debugger.
I think ILisp had a option to always send an interrupt before a command. Not sure how well that would work.
There's also CCL which has a less handicapped Windows port.
Helmut
On Mon, Dec 7, 2009 at 2:39 AM, Helmut Eller heller@common-lisp.net wrote:
- Elliott Slaughter [2009-12-07 10:30+0100] writes:
I've been reading the manual page on swank communication style, and it
sounds
like the :spawn option does what I want. Unfortunately, thread support is
not
universal, and happens to missing on one of my main development platforms (SBCL on Windows). Is there any way I can work around this (e.g. add
swank
callbacks to my application)? I know this is kind of a long shot but it
would
be kind of nice to get this working independent of implementation thread support.
There's also :sigio which doesn't need threads but probably also not available on Windows.
Your application could call swank::handle-requests from time to time. The timeout argument should be 0 to poll the socket without blocking. :fd-handler style does just that whenever SBCL performs a blocking read. For this, read-char-no-hang should work for sockets which was broken the last time I checked. Maybe it's fixed now.
When I try 0 as timeout, I get this error:
The assertion (OR (NOT SWANK::TIMEOUT) (EQ SWANK::TIMEOUT T)) failed.
When I use t as timeout, it does basically what I want, but I'd rather have the timeout be immediate (no wait). Is there any way to do this?
Also, it isn't entirely clear what I should pass as a connection to handle-requests. Right now I'm using (or swank::*emacs-connection* (swank::default-connection)) which seems to work fine.
Thanks for the help.
From Emacs, entering the debgger with C-c C-b should work most of the time (as usual, may be broken on Windows). And it should be possible to use most commands on top of the debugger.
I think ILisp had a option to always send an interrupt before a command. Not sure how well that would work.
There's also CCL which has a less handicapped Windows port.
* Elliott Slaughter [2009-12-08 01:21+0100] writes:
When I try 0 as timeout, I get this error:
The assertion (OR (NOT SWANK::TIMEOUT) (EQ SWANK::TIMEOUT T)) failed.
When I use t as timeout, it does basically what I want, but I'd rather have the timeout be immediate (no wait). Is there any way to do this?
Sorry, the argument should indeed be T and not 0. T means "nowait" and NIL means wait indefinetly.
Also, it isn't entirely clear what I should pass as a connection to handle-requests. Right now I'm using (or swank::*emacs-connection* (swank::default-connection)) which seems to work fine.
Yes, DEFAULT-CONNECTION is the correct value.
Helmut
On Tue, Dec 8, 2009 at 12:19 AM, Helmut Eller heller@common-lisp.netwrote:
- Elliott Slaughter [2009-12-08 01:21+0100] writes:
When I try 0 as timeout, I get this error:
The assertion (OR (NOT SWANK::TIMEOUT) (EQ SWANK::TIMEOUT T)) failed.
When I use t as timeout, it does basically what I want, but I'd rather
have
the timeout be immediate (no wait). Is there any way to do this?
Sorry, the argument should indeed be T and not 0. T means "nowait" and NIL means wait indefinetly.
Thanks. Works like a charm, even on Windows/SBCL :-)