Hi guys,
I'm playing around with CLX and I'd like a timer that I can use to
display a window for, say, 5 seconds and then make it disappear. The
problem is that my main "loop" if you will, is an event-case. So I
can't use sleep, since I may have to respond to events in these five
seconds.
Some sort of threading, or SIGALRM facility would work, I
*think*. I've found some evidence of an alarm in CMUCL.
Is there a standard way to do this kind of thing?
And a more general question:
Is there a standard way to have some function running in your lisp
process and still have a repl? Sorta multi-threaded? or let the user
type stuff and then at a certain point in this function you poll for
user input and eval it if it's there.
Thanks!
Shawn
Moop <····@moop.moop> writes:
> Is there a standard way to have some function running in your lisp
> process and still have a repl? Sorta multi-threaded? or let the user
> type stuff and then at a certain point in this function you poll for
> user input and eval it if it's there.
In CMUCL, look for the mp package. I am not good at this, but...
(defun threadfunc ()
(sleep 4)
(format t "done~%"))
(mp:make-process #'threadfunc)
I have not found a lot of documentation, but the source file
multi-proc.lisp gives some clues.
Observer that this is really threads in the user process without support
from the OS. The "multiprocess" notation is historical.
--
Hilsen
Johan Ur Riise
Johan Ur Riise <·····@riise-data.no> writes:
> Moop <····@moop.moop> writes:
>
>
> > Is there a standard way to have some function running in your lisp
> > process and still have a repl? Sorta multi-threaded? or let the user
> > type stuff and then at a certain point in this function you poll for
> > user input and eval it if it's there.
>
> In CMUCL, look for the mp package. I am not good at this, but...
>
> (defun threadfunc ()
> (sleep 4)
> (format t "done~%"))
>
> (mp:make-process #'threadfunc)
>
Thanks Johan.
I've looked into it some more and I've also found the Ports library in
CLOCC (www.cliki.net/clocc). This multi-process stuff in it is
portable but it seems like not very many lisps have multi-process
stuff.