title: Meaning of daemon property on Python Threads
body: <p>I'm a little confused about what setting a thread to be a daemon means. </p>
  
  <p>The documentation says this:</p>
  
  <blockquote>
    <p>A thread can be flagged as a “daemon
    thread”. The significance of this flag
    is that the entire Python program
    exits when only daemon threads are
    left. The initial value is inherited
    from the creating thread. The flag can
    be set through the daemon property.</p>
  </blockquote>
  
  <p>I'm not sure what makes this different from a normal thread. </p>
  
  <p>Is this saying that this program won't ever finish?</p>
  
  <pre><code>def threadfunc():
      while True:
          time.sleep(1)
  
  threading.Thread(target=threadfunc).start()
  </code></pre>
  
  <p>Even though the main thread finishes it's execution. While will finish immediately?</p>
  
  <pre><code>def threadfunc():
      while True:
          time.sleep(1)
  
  th = threading.Thread(target=threadfunc)
  th.daemon = True
  th.start()
  </code></pre>
  
  <p>I ask because I have a situation where in my main thread I'm calling sys.exit(), and the process just hangs and my other threads are running as I can see the log. </p>
  
  <p>Does this have anything to do with sys.exit() being called with threads alive?</p>