title: Multi-threading program in python, only one sub-threads work and program didnot quit normally even though I use join()
body: <p>I created ten threads to process item in a global list
  but I do not why only the first worker do this work
  and also, the main thread finished before sub-threads finished, even though I had used the thread.join().
  here is the code, I think the problem may because I use while loop in  myThread.run . but I do not know how to tell these threads keep working before the global list is empty.</p>
  <pre><code># coding=utf-8
  import threading
  import numpy as np
  
  dfs = ['units' + str(i).zfill(5) for i in range(250)]
  units = dfs.copy()
  k = [str(i).zfill(5) for i in range(500, 21800000)]
  units.extend(k)
  np.random.shuffle(units)
  marker = []
  
  
  def working_fun(df, unit):
      global marker
      if unit in df:
          threadlock.acquire()
          marker.append(int(unit[5:]))
  
  
  class myThread(threading.Thread):
      def __init__(self, name):
          threading.Thread.__init__(self)
          self.name = name
          self.work_load = []
  
      def run(self):
          global dfs
          print(&quot;start thread&quot; + self.name)
  
          while True:
              threadlock.acquire()
              if units != []:
                  unit = units.pop()
              else:
                  unit = None
              threadlock.release()
  
              if unit is not None:
                  self.work_load.append(unit)
                  working_fun(dfs, unit)
              else:
                  print('------', self.name, '--finish---', len(self.work_load), '--------')
                  break
  
  
  threadlock = threading.RLock()
  
  thds = []
  for i in range(10):
      thd = myThread(name='thd' + str(i))
      thds.append(thd)
  for thd in thds:
      thd.start()
      thd.join()
  
  print('output:', marker)
  </code></pre>