title: How to close a thread when multithreading?
body: <p>To simplify the situation I'm having: I'm trying to terminate a thread while it is still running in Python 2.7, and I'm not sure how to do it. </p>
  
  <p>Take this simple code:</p>
  
  <pre><code>import time
  import threading
  
  def thread1():
          print "Starting thread 1"
          while True:
                  time.sleep(0.5)
                  print "Working"
  
  thread1 = threading.Thread(target=thread1, args=())
  thread1.start()
  
  time.sleep(2)
  print "Killing thread 1"
  thread2.stop()
  print "Checking if it worked:"
  print "Thread is: " + str(thread1.isAlive())
  </code></pre>
  
  <p>Thread 1 keeps on 'working' and I'm trying to kill it in the main thread. Any idea on how to do it? I've tried:</p>
  
  <pre><code>threat1.terminate
  threat1.stop
  threat1.quit
  threat1.end
  </code></pre>
  
  <p>This all seems to point that there is no way to really stop it with a simple line of code. What could you suggest?</p>