title: Python - Simple thread won't stop
body: <p>I'm having a problem with a python script using threads. I could mimic the problem with the following code:</p>
  
  <pre><code>from threading import Thread
  
  def func1():
      while True:
          print 'Function 1'
  
  def main():
      t = Thread(target = func1)
  
      t.start()
  
      for i in xrange(100000):
          print 'Main'
  
      t.stop()
  
      print 'End'
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>The problem is when I interrupt the script with <strong><em>Ctrl + C</em></strong> or when it reaches its end, the thread running <code>func1()</code> won't stop.</p>
  
  <p>I can only interrupt the execution if open the terminal and <code>killall python</code>.</p>
  
  <p>This is the first time I'm working with threads in Python. What am I doing wrong? </p>