def stop(self): # Technically not thread-safe but close enough for now process_thread = self.process_thread self.process_thread = None if process_thread != None: process_thread.stop() process_thread.join(self.TIMEOUT) if process_thread.isAlive(): raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die") Resource.stop(self)
def stop(self): self.threadControlLock.acquire() try: process_thread = self.process_thread self.process_thread = None if process_thread != None: process_thread.stop() process_thread.join(self.TIMEOUT) if process_thread.isAlive(): raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die") Resource.stop(self) finally: self.threadControlLock.release()
def stop(self): self._log.debug("stop()") try: if self.get_commandAlive() == True: for sig, timeout in self.STOP_SIGNALS: try: os.kill(self._pid, sig) except OSError: self._pid = None return if timeout != None: giveup_time = time.time() + timeout while os.waitpid(self._pid, os.WNOHANG) == (0,0): time.sleep(0.1) if time.time() > giveup_time: break else: # Wait until there is a response os.waitpid(self._pid, 0) self._pid = None finally: Resource.stop(self)
def stop(self): if not ThreadedComponent.stopThread(self, self.TIMEOUT): raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die") Resource.stop(self)
def stop(self): Resource.stop(self) pipe_off() pipe_wait()