Re: Automatic exception rasier--a timer

Guido.van.Rossum@cwi.nl
Mon, 25 Jul 1994 17:06:20 +0200

> > From: "I-feng Kao - EECS (CPTS317)" <ikao@gandalf.eecs.wsu.edu>
> > Date: Sat, 23 Jul 1994 21:34:12 GMT
> >
> > In library of C, there is a function alarm() which can send a signal after
> > specified time. However, I read through the documents of 1.0.2 and found
> > nothing similar to the function. It seems that the only choice I have is
> > extend python intepreter, which I really do want to do.
> >
> > Solutions and suggestions are welcome.
>
> Well.. I am not exactly sure if this will work, but I posted a signal
> module for Python.. This module (with patches to some of the other system
> files) lets you set callbacks and signal handlers for all of the available
> signals except SIGKILL... You might be able to do something with this...
> If someone can find it on an achive site, I reposted it just a week ago
> or so... I know it will be in the next major release of Python if
> you can wait that long...

Unfortunately, I don't think that the version last posted would help
you much. To make the signal module work well, I had to change the
interface used to check for interrupts, and make little changes all
over the source. The good news is that it now works satisfactorily,
and even interacts properly with threads (though only the main thread
can use signals -- the semantics of the interaction between signals
and threads is too different for different thread implementations).
I hope you can all wait (indefinitely :-) till the release of 1.0.4
(or, more likely, given the number of changes, 1.1).

Regarding alarm(), I think this should be added to the signal module
as well, as it makes no sense to have it without signals.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>