def process_wait(self, timeout=None): if not timeout: timeout = 0 else: # WaitForSingleObject() expects time in milliseconds timeout = int(timeout * 1000) ret = _psutil_mswindows.process_wait(self.pid, timeout) if ret == -1: raise TimeoutExpired(self.pid, self._process_name) return ret
def process_wait(self, timeout=None): if timeout is None: timeout = INFINITE else: # WaitForSingleObject() expects time in milliseconds timeout = int(timeout * 1000) ret = _psutil_mswindows.process_wait(self.pid, timeout) if ret == WAIT_TIMEOUT: raise TimeoutExpired(self.pid, self._process_name) return ret
def process_wait(self, timeout=None): try: return _psposix.wait_pid(self.pid, timeout) except TimeoutExpired: raise TimeoutExpired(self.pid, self._process_name)
def check_timeout(delay): if timeout is not None: if time.time() >= stop_at: raise TimeoutExpired(pid) time.sleep(delay) return min(delay * 2, 0.04)