title: My thread runs every 10 secs but sometimes the function takes longer to run. How do I make the timer wait until the function executes?
body: <p>My threading is set up exactly like the top answer from <a href="https://stackoverflow.com/questions/3393612/run-certain-code-every-n-seconds/17492865">here</a>. Except that my function is more complex than a print. </p>
  
  <pre><code>import threading
  
  def printit():
    threading.Timer(10.0, printit).start()
    print "Hello, World!"
  
  printit()
  </code></pre>
  
  <p>The function takes about 6 seconds to run. On rare occasions, it takes 12-13 seconds to run. Without incurring opportunity costs by extending the wait time, how do I make this timer wait until the function runs?</p>