How to terminate the function that runs every n seconds
Ganesh Pal
ganesh1pal at gmail.com
Wed Jan 14 12:26:11 EST 2015
> Do you want to fix the symptom, fix the problem, or finish a school
> assignment? To do the first, make a global variable that contains the time
> you want to stop making new threads, and conditionally test it before
> calling threading.Timer
>
I firstly apologise for multiple posts and thanks for the reply . I
was actually in hurry to complete my assignment and there was no way
to figure out what was going wrong !!
My assignment was to write a subroutine that run itself every n
minutes and terminate before the main thread completes.
I thought threading.Timer helped me achieve this but timer.cancel()
didn't help me terminate the timer .
> Something like
> quit_time = timer.time() + 4
>
Thanks for the above hint, I will try this and get back to you
> Note that neither Timer nor sleep makes any promises about how accurately it
> matches the requested time.
Sure will keep this in mind
Regards ,
Ganesh
More information about the Python-list
mailing list