469,324 Members | 1,451 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,324 developers. It's quick & easy.

how to Running a particular funtion at a regular interval of time

21
I'm executing two function in a program in a infinite loop.

In that loop i want run a particular a particular function which is out side the function, but that function also runs simultaneously with that function.

when i tried with the threading.Timer(), the function that is to be executed, it throws an exception as cannot start another thread of that function. As that function is already running in the loop.

Can u provide me the solution ASAP.

Thanks in advance......
Mar 13 '09 #1
6 3323
bvdet
2,851 Expert Mod 2GB
I don't know if I can help you, but you would be more likely to receive help if you posted your code.

-BV, Moderator
Mar 13 '09 #2
neeru29
21
[:)]
I found a way to run it....
anyway thanks...........
Mar 14 '09 #3
bvdet
2,851 Expert Mod 2GB
Would you care to share your solution with us in case someone else has this problem?
Mar 14 '09 #4
neeru29
21
yaa sure....
Expand|Select|Wrap|Line Numbers
  1. import time 
  2. the_time = time.time()
  3. Timer_Counter = 30
  4.  
  5. def sample(request)
  6.     global the_time
  7.     elapsed_time = time.time() - the _time
  8.     if elapsed_time < 0
  9.          do.....something or call a function
  10.          the_time() = time.time()

Here the Sample function runs in infinite loop.
after every 30 seconds the some other code also executes....
Mar 14 '09 #5
bvdet
2,851 Expert Mod 2GB
Thank you for sharing. I added code tags around your code. That makes it easier to read and the indentation is preserved.

-BV
Mar 14 '09 #6
neeru29
21
thank you very much........................
Mar 14 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Todd | last post: by
14 posts views Thread by William LaMartin | last post: by
4 posts views Thread by tshad | last post: by
1 post views Thread by daniel_xi | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.