rif <[EMAIL PROTECTED]> writes:
> I'm pretty lost here. What I'd like to achieve is that update-r gets
> called automatically during interactive use (I realize that the
> user-level threading implies that it won't get called while functions
> are running unless they yield) in the REPL. Any advice is
> appreciated.
(let ((s *standard-output*))
(mp:make-process (lambda ()
(let ((*standard-output* s))
(dotimes (i 100)
(print i)
(force-output)
(sleep 0.5))))))
(mp:all-processes)
Works for me. It creates a background thread and ALL-PROCESSES
returns the "initial" and an "anonymous" thread. I captured the value
of *standard-output* and passed it down the new thread to redirect the
output to the SLIME output buffer; if we don't bind *standard-output*,
the output is printed in the *inferior-lisp* buffer.
mp::startup-idle-and-top-level-loops is an infinite loop and never
returns; before looping, it creates a new thread which acts as the new
listener. Having the idle thread usually improves responsiveness;
without the idle loop, scheduling is only triggered once a second by
the *periodic-polling-function* (unless you adjust
*max-event-to-{sec,usec}*).
> Note that I am using slime with the :fd-handler communication-style,
>if that's relevant.
mp::startup-idle-and-top-level-loops cannot be called from the SLIME
REPL, because the function never returns. However, calling it in the
*inferior-lisp* buffer or .cmucl-init should work as intended.
Helmut.