code: def run(self):
      
      # construct WebCache object locally
      thread_id, args, kwargs = self.execute_queue.get_nowait()
      try:
        cache_obj = WebCache(*args, **kwargs)
      except Exception as e:
        self.exception_queue[thread_id].put_nowait(e)
        self.loop = False
      self.execute_queue.task_done()
  
      # execute loop
      while self.loop:
        msg = self.execute_queue.get()
        if msg is None:
          # thread exist requested
          assert(not self.loop)
          break
        thread_id, method, args, kwargs = msg
        try:
          result = method(cache_obj, *args, **kwargs)
        except Exception as e:
          self.exception_queue[thread_id].put_nowait(e)
        else:
          self.result_queue[thread_id].put_nowait(result)
        self.execute_queue.task_done()
docs: Thread loop.