def wait(self, readfds, writefds, timeout):
logger.debug("<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>for fd in readfds:<EOL><INDENT>self.rwait[fd].add(self._current)<EOL><DEDENT>for fd in writefds:<EOL><INDENT>self.twait[fd].add(self._current)<EOL><DEDENT>if timeout is not None:<EOL><INDENT>self.timers[self._current] = self.clocks + timeout<EOL><DEDENT>procid = self._current<EOL>next_index = (self.running.index(procid) + <NUM_LIT:1>) % len(self.running)<EOL>self._current = self.running[next_index]<EOL>logger.debug(f"<STR_LIT>")<EOL>logger.debug(f"<STR_LIT>")<EOL>self.running.remove(procid)<EOL>if self._current not in self.running:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>self._current = None<EOL>self.check_timers()<EOL><DEDENT>
Wait for file descriptors or timeout.
            Adds the current process in the correspondent waiting list and
            yield the cpu to another running process.