Subject: [clisp-list] Timer or alarm?

From: Pascal Bourguignon <[email-masked]>
Date: Wed Jan 29 23:09:01 2003

I've not found anything  in CLHS or in CLISP to set  a timer and get a
signal on time-out.

How to implement a:   (with-time-out (60 second) 
                          (do-something-may-be-too-complicated))
?

Am I  right to think  that it should  be implemented in C? 

Even if  we don't ask  to be  able to run  arbitrary LISP code  in the
signal handler, at  least two things would be useful to  be able to be
do upon receiving a signal:

    - setting a variable, and/or
    - throwing a given tag.

The trowing  could of  course occur after  the signal  handler exists,
when the  interpreter find it  convenient to execute it  (when current
instruction or garbage collecting is done).

(Perhaps support for signals is linked to support of threads...)

-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie

---

From: Sam Steingold <[email-masked]>
Date: Thu Jan 30 09:54:05 2003

> * In message <[email-masked]>
> * On the subject of "Timer or alarm?"
> * Sent on Thu, 30 Jan 2003 08:07:31 +0100 (CET)
> * Honorable Pascal Bourguignon <[email-masked]> writes:
>

$ ./configure --with-threads=POSIX_THREADS --build build-mt
$ cd build-mt
$ ./clisp
> (with-timeout (3 (format t "timed out!~%")) (sleep 10))
timed out
> 4
4
segfault

if you debug this segfault, you will have a working WITH-TIMEOUT.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Growing Old is Inevitable; Growing Up is Optional.