title: Threads not exiting and program won't exit
body: <p>Using the script below, I cannot seem to exit the threads. The script runs smoothly without issues but never exits when done. I can still see the thread alive, I have to use <code>htop</code> to kill them or completely exit the command line.</p>
  
  <p>How can I get this script to exit and the threads to die?</p>
  
  <pre><code>def async_dns():
      s = adns.init()
      while True:
          dname = q.get()
          response = s.synchronous(dname,adns.rr.NS)[0]
          if response == 0:
              dot_net.append("Y")
              print(dname + ", is Y")
          elif response == 300 or response == 30 or response == 60:
              dot_net.append("N")
              print(dname + ", is N")
          elif q.empty() == True:
              q.task_done()
  
  q = queue.Queue()
  threads = []
  for i in range(20):
      t = threading.Thread(target=async_dns)
      threads.append(t)
      t.start()
  
  for name in names:
      q.put_nowait(name)
  </code></pre>