def waitpid(self):
        # firstly send a signal to all resumed processes to check if they are
        # still running. resumed process is NOT spawned child process of
        # supervisord, so the os.waitpid doesn't work.
        for pid in self.resumed_pids:
            try:
                os.kill(pid, 0)
            except:
                # got an exception, we blindly consider the process has exited.
                self.resumed_pids.remove(pid)
                return pid, 0

        # need pthread_sigmask here to avoid concurrent sigchild, but
        # Python doesn't offer it as it's not standard across UNIX versions.
        # there is still a race condition here; we can get a sigchild while
        # we're sitting in the waitpid call.
        try:
            pid, sts = os.waitpid(-1, os.WNOHANG)
        except __HOLE__, why:
            err = why[0]
            if err not in (errno.ECHILD, errno.EINTR):
                self.logger.critical(
                    'waitpid error; a process may not be cleaned up properly')
            if err == errno.EINTR:
                self.logger.blather('EINTR during reap')
            pid, sts = None, None
        return pid, sts
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.waitpid