code: def stop(self, timeout=None):
          
          with self._lock:
              if self._thread:
                  self._queue.put_nowait(self._terminator)
                  self._thread.join(timeout=timeout)
                  self._thread = None
                  self._thread_for_pid = None
docs: Stops the task thread. Synchronous!