class_docstr: Thread in which garbage collection actually happens.
class_docstr_tok: ["Thread","in","which","garbage","collection","actually","happens","."]
code: def run(self):
      # detect fork at beginning of the thread
      if getpid is None or getpid() != self.pid:
          self.ready.set()
          return
      try:
          s = self.gc.context.socket(zmq.PULL)
          s.linger = 0
          s.bind(self.gc.url)
      finally:
          self.ready.set()
  
      while True:
          # detect fork
          if getpid is None or getpid() != self.pid:
              return
          msg = s.recv()
          if msg == b"DIE":
              break
          fmt = "L" if len(msg) == 4 else "Q"
          key = struct.unpack(fmt, msg)[0]
          tup = self.gc.refs.pop(key, None)
          if tup and tup.event:
              tup.event.set()
          del tup
      s.close()
  
imports: import atexit
  import struct
  import warnings
  from collections import namedtuple
  from os import getpid
  from threading import Event, Lock, Thread
  import zmq
label_desc: Use image node_id 2 for calling the GarbageCollectorThread obj's underlying member method code with example usage: obj.run() without return types