code: def __cleanup(self):
          self._run.value = False
          if check_process_termination(proc                     = self._proc,
                                       timeout                  = 2*self.interval,
                                       prefix                   = '',
                                       auto_kill_on_last_resort = self._auto_kill_on_last_resort):
              log.debug("cleanup successful")
          else:
              raise RuntimeError("cleanup FAILED!")
          try:
              self.conn_send.close()
              self._log_queue_listener.stop()
          except OSError:
              pass
          log.debug("wait for monitor thread to join")
          self._monitor_thread.join()
          log.debug("monitor thread to joined")
          self._func_running.value = False