Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83770 > unrolled thread

Re: How to terminate the function that runs every n seconds

Started byGanesh Pal <ganesh1pal@gmail.com>
First post2015-01-14 22:56 +0530
Last post2015-01-14 22:56 +0530
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to terminate the function that runs every n seconds Ganesh Pal <ganesh1pal@gmail.com> - 2015-01-14 22:56 +0530

#83770 — Re: How to terminate the function that runs every n seconds

FromGanesh Pal <ganesh1pal@gmail.com>
Date2015-01-14 22:56 +0530
SubjectRe: How to terminate the function that runs every n seconds
Message-ID<mailman.17731.1421256380.18130.python-list@python.org>
> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web