def run(self):
        while not self.finished.is_set():
            usedCpuTime = self.read_cputime() if CPUACCT in self.cgroups else 0
            remainingCpuTime = self.timelimit - usedCpuTime
            remainingSoftCpuTime = self.softtimelimit - usedCpuTime
            remainingWallTime = self.latestKillTime - util.read_monotonic_time()
            logging.debug(
                "TimelimitThread for process %s: used CPU time: %s, remaining CPU time: %s, "
                "remaining soft CPU time: %s, remaining wall time: %s.",
                self.pid_to_kill, usedCpuTime, remainingCpuTime,
                remainingSoftCpuTime, remainingWallTime)
            if remainingCpuTime <= 0:
                self.callback('cputime')
                logging.debug('Killing process %s due to CPU time timeout.', self.pid_to_kill)
                self.kill_process(self.pid_to_kill, self.cgroups)
                self.finished.set()
                return
            if remainingWallTime <= 0:
                self.callback('walltime')
                logging.warning('Killing process %s due to wall time timeout.', self.pid_to_kill)
                self.kill_process(self.pid_to_kill, self.cgroups)
                self.finished.set()
                return

            if remainingSoftCpuTime <= 0:
                self.callback('cputime-soft')
                # soft time limit violated, ask process to terminate
                self.kill_process(self.pid_to_kill, self.cgroups, signal.SIGTERM)
                self.softtimelimit = self.timelimit

            remainingTime = min(remainingCpuTime/self.cpuCount,
                                remainingSoftCpuTime/self.cpuCount,
                                remainingWallTime)
            self.finished.wait(remainingTime + 1)
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/runexecutor.py/_TimelimitThread.run/original