[Tutor] after signal handler

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Mar 6 19:33:13 CET 2006



On Mon, 6 Mar 2006, Hameed U. Khan wrote:

>  I want to go back after signal handler to the isntruction where I was
> stuck. Below is the code I'm trying to play with.

Hi Hameed,

Here's a small test program that shows that the signal handling does go
back to where we left off:

##############################################
import signal
import time

def handler(signum, frame):
    print "alarm!"
    signal.alarm(2)

signal.signal(signal.SIGALRM, handler)
signal.alarm(2)

while True:
    print "hello"
    time.sleep(1)
###############################################



> What I'm trying to do is to implement a prompt with the remaining time
> they have to enter some input.

This should be doable.  What can we help with?



More information about the Tutor mailing list