def _wait_event_pid(self, wanted_pid, blocking=True):
"""
Wait for a process event from the specified process identifier. If
blocking=False, return None if there is no new event, otherwise return
an object based on ProcessEvent.
"""
process = None
while not process:
try:
pid, status = self._waitpid(wanted_pid, blocking)
except OSError as err:
if err.errno == ECHILD:
process = self.dict[wanted_pid]
return process.processTerminated()
else:
raise err
if not blocking and not pid:
return None
try:
process = self.dict[pid]
except KeyError:
warning("waitpid() warning: Unknown PID %r" % pid)
return process.processStatus(status)
评论列表
文章目录