parameters: (self, timeout=None)
docstring: Stops running threads and wait for them to exit, if necessary.
  
      Should be called by the same thread which called `start()`.
  
      Arguments:
          timeout: maximum time to wait on `thread.join()`
docstring_summary: Stops running threads and wait for them to exit, if necessary.
docstring_tokens: Stops running threads and wait for them to exit if necessary .
function: def stop(self, timeout=None):
      """Stops running threads and wait for them to exit, if necessary.
  
      Should be called by the same thread which called `start()`.
  
      Arguments:
          timeout: maximum time to wait on `thread.join()`
      """
      self.stop_signal.set()
      with self.queue.mutex:
        self.queue.queue.clear()
        self.queue.unfinished_tasks = 0
        self.queue.not_full.notify()
      self.executor.close()
      self.executor.join()
      self.run_thread.join(timeout)
function_tokens: def stop ( self , timeout = None ) : self . stop_signal . set ( ) with self . queue . mutex : self . queue . queue . clear ( ) self . queue . unfinished_tasks = 0 self . queue . not_full . notify ( ) self . executor . close ( ) self . executor . join ( ) self . run_thread . join ( timeout )