code: def stop(self):
          
          if not self.stopped():
              self._stop.set()
              for worker in self._workers:
                  worker.join()
docs: Signals the worker threads to exit and waits on them.