class_docstr: Manager for resources using background thread.
class_docstr_tok: ["Manager","for","resources","using","background","thread","."]
docstr: Stop the background thread and clear registered resources.
docstr_tok: ["Stop","the","background","thread","and","clear","registered","resources","."]
code: def stop(self, timeout=None):
      """Stop the background thread and clear registered resources."""
      from .connection import Client
  
      with self._lock:
          if self._address is not None:
              c = Client(
                  self._address,
                  authkey=process.current_process().authkey,
              )
              c.send(None)
              c.close()
              self._thread.join(timeout)
              if self._thread.is_alive():
                  util.sub_warning(
                      "_ResourceSharer thread did "
                      "not stop when asked"
                  )
              self._listener.close()
              self._thread = None
              self._address = None
              self._listener = None
              for key, (send, close) in self._cache.items():
                  close()
              self._cache.clear()
  
file_path: cpython/Lib/multiprocessing/resource_sharer.py
imports: import os
  import signal
  import socket
  import sys
  import threading
  from .None import process
  from .context import reduction
  from .None import util
label_desc: Use image node_id 4 for calling the _ResourceSharer obj's underlying member method code with example usage: obj.stop(timeout) without return types