title: How to start and stop a thread
body: <p>How can I start and stop a thread with my poor thread class?</p>
  <p>It is in loop, and I want to restart it again at the beginning of the code. How can I do start-stop-restart-stop-restart?</p>
  <p>My class:</p>
  <pre><code>import threading
  
  class Concur(threading.Thread):
      def __init__(self):
          self.stopped = False
          threading.Thread.__init__(self)
  
      def run(self):
          i = 0
          while not self.stopped:
              time.sleep(1)
              i = i + 1
  </code></pre>
  <p>In the main code, I want:</p>
  <pre><code>inst = Concur()
  
  while conditon:
      inst.start()
  
      # After some operation
      inst.stop()
  
      # Some other operation
  </code></pre>