On 04/10/2007, Kamal <[EMAIL PROTECTED]> wrote:
> Basically, I want to call functionOne() every x minutes, and wondering
> whats the best way to do it.
If you need to run the functions concurrently, use threads. Else you
can setup a simple signal-handler for SIGALRM and set the time
accordingly:
import signal
def setup_signal():
# Wait 5 seconds before alarming
signal.alarm(5)
signal.signal(signal.SIGALRM, signal_handler)
def signal_handler(signum, frame):
print "I got an alarm!"
# need to resetup the signal
setup_signal()
setup_signal()
# A pointless loop
for x in xrange(500000000):
if (x % 100000) == 0:
print x
--
- Rikard - http://bos.hack.org/cv/
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor