Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83770
| References | <CACT3xuWvN=zUs5CmuxceG9yv2gPWkmxF2dTgWOr8WqmaJxag+A@mail.gmail.com> <CACT3xuUr-07yW-FjiKBjPbsbn5j7r1vUfu1E0A6Myz=7sYpnzA@mail.gmail.com> <54B69A5B.5000801@davea.name> |
|---|---|
| Date | 2015-01-14 22:56 +0530 |
| Subject | Re: How to terminate the function that runs every n seconds |
| From | Ganesh Pal <ganesh1pal@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17731.1421256380.18130.python-list@python.org> (permalink) |
> 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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to terminate the function that runs every n seconds Ganesh Pal <ganesh1pal@gmail.com> - 2015-01-14 22:56 +0530
csiph-web